Python SDK to interact with www.worldtradingdata.com
Project description
World Trading Data Python SDK
This is an UNOFFICIAL SDK. That means that neither this repo nor the author have any relationship with World Trading Data. This repo is simply a tool built to make it easier to integrate with the rest API.
This SDK is designed to access financial data. Therefore the author would like to stress that what you do with any data you may get through this SDK is your problem and yours alone. I take absolutely zero responsibility for any losses or problems that may arise from using this SDK
Getting Started
This SDK will require you to have an account with World Trading Data (sign up here)
Be advised, there are as yet no stable releases for this package and it is 100% definitely still in development and breaking changes (while avoided) may be deployed at any time. You have been warned.
Installation
- Make sure you have pip installed
- In the console
pip install worldtradingdata
then in python...
>>> from worldtradingdata import WorldTradingData
>>> my_api_token = get_my_token_from_somewhere_safe()
# provide the api_token once when creating the WorldTradingData instance.
# you do not need to provide the api_token on each request
>>> wtd = WorldTradingData(my_api_token)
>>> wtd.stock_search('AAPL') # will find all your favourite fruity stocks
General Guidance
Required arguments should be given individually, and optional arguments should be supplied as a dictionary, with the param name as the key, and the param value as the value.
e.g.
Perform a basic stock search with
wtd.stock_search('AAPL')
Anything which is an optional query string param in the official docs can be passed in a dictionary as a second argument (see official docs for full argument reference).
optional_params = {'output': 'csv', 'currency': 'usd'}
wtd.stock_search('AAPL', optional_params)
Methods have been named in accordance with the url path suffix for that request in the official docs.
i.e. if the base url of a request is
https://api.worldtradingdata.com/api/v1
and the final url for a Forex History request is
https://api.worldtradingdata.com/api/v1/forex_history
then the url path suffix of the request is considered to be /forex_history.
All the methods in the SDK are named according to their corresponding url path suffix without the /.
e.g. wtd.forex_history(args, in, here)
Method Reference
Please be aware that this SDK is designed to be a loose wrapper around the official REST API provided by www.worldtradingdata.com . That means that it does not include pre-flight checks to make sure your provided arguments are correct. This provides much more flexibility, but it means if you provide poorly formed arguments to the SDK, they will be ignored and the results you get might not be what you expect.
I'm working on stricter type checking for version 2.
# note: 'api_token' is supplied automatically
Real Time Market Data
full reference at https://www.worldtradingdata.com/documentation#real-time-market-data
Stock and Index Real Time
wtd.stock(symbol: list [, optional_params: dict])
example
more_params = {'output': 'csv'}
wtd.stock(['AAPL', 'GOOG'], more_params)
Mutual Fund Real Time
wtd.mutual_fund(symbol: list [, optional_params: dict])
example
my_symbol_array = ['AAAAX', 'AAADX', 'AAAGX']
wtd.mutual_fund(my_symbol_array)
Intraday Market Data
full reference at https://www.worldtradingdata.com/documentation#intraday-market-data
Stock and Index Intraday
wtd.intraday(symbol: str, interval: int, range: int [, optional_params: dict])
Historical Market Data
Full History
wtd.history(symbol: str [, optional_params: dict])
Multi Single Day History
wtd.history_multi_single_day(symbol: str, date: str [, optional_params: dict])
# date should be formatted as 'YYYY-MM-DD'
Forex
Real Time
wtd.forex(base: str)
Historical
wtd.forex_history(base: str, convert_to: str [, optional_params: dict])
Single Day History
wtd.forex_single_day(base: str, date: str [, optional_params: dict])
Searching Stocks
wtd._stock_search(search_term: string [, optional_params: dict])
Perform a basic stock search with
wtd.stock_search('AAPL')
Anything which is a query_string param in the official docs can be passed in the dictionary of optional params (see official docs for searching)
optional_params = {'output': 'csv', 'currency': 'usd'}
wtd.stock_search('AAPL', optional_params)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file worldtradingdata-0.1.1.tar.gz.
File metadata
- Download URL: worldtradingdata-0.1.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35dde746a389a9f8409b512bd18eda5e03e9933a6df056eda4006f90d81561e
|
|
| MD5 |
bfc6403c3992d46900c19d17e1788220
|
|
| BLAKE2b-256 |
781abfc118b47b81cdc8072b9df2ffd2ce4c8eaf7ffa89d1caa40e38fe7d3896
|
File details
Details for the file worldtradingdata-0.1.1-py3-none-any.whl.
File metadata
- Download URL: worldtradingdata-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdf8c5eafb85dfedaa1051ee670db49d4957eec61ad3e4c9902281ffc1d73c46
|
|
| MD5 |
b8b4baf0786f3be4a81bee0975e67184
|
|
| BLAKE2b-256 |
b620481a7e33b8e2336b10e9becbbd028c2ab70d12171864b688f06a06afd084
|