Kpler Python SDK
The Kpler Python SDK provides access to Kpler data.
It can be easily integrated into notebooks, scripts, and applications.
It is available to all Kpler API clients.
Example
1from datetime import date, timedelta
2
3from kpler.sdk import Platform
4from kpler.sdk.configuration import Configuration
5from kpler.sdk.resources.trades import Trades
6
7
8config = Configuration(Platform.Liquids, "<your email>", "<your password>")
9
10trades_client = Trades(config)
11
12# Get US imports over last week
13us_imports = trades_client.get(
14 to_zones=["United States"],
15 products=["crude"],
16 with_forecast=False,
17 with_intra_country=True,
18 start_date=date.today() - timedelta(days=7),
19 columns=[
20 "vessel_name",
21 "closest_ancestor_product",
22 "closest_ancestor_grade",
23 "start",
24 "end",
25 "origin_location_name",
26 "destination_location_name",
27 ],
28)
returns :
vessel_name |
closest_ancestor_product |
closest_ancestor_grade |
start |
end |
origin_location_name |
destination_location_name |
---|---|---|---|---|---|---|
Eco Bel Air |
crude |
Basrah |
2020-11-01 14:20:00 |
2020-12-14 01:02:00 |
Al Basrah |
PADD 5 |
Stella |
crude |
NaN |
2020-10-30 09:48:00 |
2020-12-09 21:30:00 |
Angra dos Reis |
PADD 5 |
Cap Charles |
crude |
NaN |
2020-10-21 05:47:00 |
2020-11-20 23:15:00 |
Angra dos Reis |
Long Beach |
Sebarok Spirit |
crude |
Maya |
2020-10-21 01:00:00 |
2020-10-24 06:49:00 |
Yuum Kak Naab FPSO |
Houston |
Montreal Spirit |
crude |
NaN |
2020-10-20 13:30:00 |
2020-11-24 01:18:00 |
Sao Sebastiao |
Cherry Point |
Washington |
crude |
ANS |
2020-10-19 14:48:00 |
2020-10-27 00:00:00 |
Valdez |
San Francisco |
… |
… |
… |
… |
… |
… |
… |