Skip to main content

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. Nor am I responsible for the accuracy of any of the data.
In the words of GNU (even though this project is under the MIT license),
"This software comes with ABSOLUTELY NO WARRANTY"

Getting Started

This SDK will require you to have an account with World Trading Data (sign up here)

Installation

  1. Make sure you have pip3 or pip installed
  2. In the console pip3 install worldtradingdata==0.1.1

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 reference at https://www.worldtradingdata.com/documentation#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

full reference at https://www.worldtradingdata.com/documentation#forex-data
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

full reference at https://www.worldtradingdata.com/documentation#searching
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.

optional_params = {'output': 'csv', 'currency': 'usd'}
wtd.stock_search('AAPL', optional_params)

Metadata

Release files for worldtradingdata 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for worldtradingdata 0.1.5
File Size Uploaded Provenance Actions
worldtradingdata-0.1.5.tar.gz 9.1 kB Without provenance Details for worldtradingdata-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for worldtradingdata 0.1.5
File Interpreter ABI Platform Actions
worldtradingdata-0.1.5-py3-none-any.whl Python 3 none any Details for worldtradingdata-0.1.5-py3-none-any.whl

Total release size: 19.0 kB

Release files / worldtradingdata-0.1.5.tar.gz

Download URL worldtradingdata-0.1.5.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
89bd6161e924a59085133b0ba2b9cb8fd9af138712b5fd6147baa8260f79626f
BLAKE2b-256 checksum
How to use checksums
5779f70296559d2706267e46fbc2ee5d6e6fb90de633d97d0e113205a908c62d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / worldtradingdata-0.1.5-py3-none-any.whl

Download URL worldtradingdata-0.1.5-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02409479a34ab1b26a58737704ce503725e016ca51844bae80e5daf0f92102e9
BLAKE2b-256 checksum
How to use checksums
b45e9385b5ebc59571a891d42107d5ecc28beb896ddffbc06fffc05712a70773
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for worldtradingdata 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page