Extracting Flows Data in Python

image.jpg

is there a way to pull this information through Python or Excel?

import lseg.data as ld

import pandas as pd

ld.open_session()

ld.get_data(universe=['C}KV7309950155'],

   fields=['TR.AssetLoadingPort','TR.AssetLoadingGeography','TR.AssetLoadingDateFrom','TR.AssetLoadingDateTo','TR.AssetPreviousZone','TR.AssetDischargingPort','TR.AssetDischargingGeography','TR.AssetDepartureDate','TR.AssetArrivalDateFrom','TR.AssetArrivalDateTo','TR.AssetDischargeDate','TR.AssetVolume','TR.AssetDestinationZone','TR.AssetName','TR.AssetType','TR.AssetFlowGrade','TR.AssetFlowCommodity'])

i can up with the code above but its not what is needed. the user would like to show all the clean product tankers that are in Load (Supply) US Gulf. or Discharge (Demand) US Gulf.

I’m looking more for the Flows tab for Clean Products. So, I would want to know on the Discharge (Demand) drop down the Tanker Zones > United States TankerZones (=US Atlantic Coast, US Gulf, US West Coast) à this would be for Imports.

And then for Exports, would want the Load (Supply) drop down to have the same Tanker Zones above.

I want to be able to pull this daily and ad-hoc historically.

So I would need a script that passes in arguments for Tanker Zones, Clean Products, Import vs Export (based on Discharge/Load Regions).

Please let me know if any of this is possible.

Tagged:

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @salman.khoja01

    Thank you for reaching out to us.

    You can use the Search API to search for vessel physical assets.

    The following code can be used to list all available fields in the vessel physical assets. You can refer to this example.

    response = search.metadata.Definition(
        view = search.Views.VESSEL_PHYSICAL_ASSETS
    ).get_data()
    
    response.data.df
    
    image.png

    It doesn't have the exact Tanker Zones, Clean Products, Import vs Export fields.

    However, I think we can use these RCSOriginRegionLeaf, RCSDestinationRegionLeaf, and RCSCommodityTypeLeaf fields instead. You can refer to this example. For example:

    ld.discovery.search(
            view = ld.discovery.Views.VESSEL_PHYSICAL_ASSETS,
            filter = "RCSCommodityTypeLeaf in ('Jet Fuel' 'Naphtha' 'Gasoline' 'Diesel|Gasoline' 'Diesel') and  (RCSDestinationRegionLeaf in ('US Gulf Tanker Zone') or RCSOriginRegionLeaf eq 'US Gulf Tanker Zone')",
            select = "RIC,RCSOriginRegionLeaf,RCSDestinationRegionLeaf,RCSCommodityTypeLeaf,OriginDepartureDateTime,LocationETADateTime,PhysicalAssetStatus,RCSAssetTypeName",
            top = 1000
        )
    
    

    It returns 16 assets.

    image.png

    Then, you can use the returned RICs with the get_data method to retrieve other TR.xxx fields.

    However, please contact the helpdesk team to verify if this method is correct.