Metadata-Version: 2.4
Name: tradermade
Version: 1.1.0
Summary: A package that helps you get Forex data from TraderMade data API
Home-page: https://github.com/tradermade/Python-SDK
Author: TraderMade
Author-email: support@tradermade.com
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Topic :: Office/Business :: Financial
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.16.4
Requires-Dist: pandas>=0.24.2
Requires-Dist: requests>=2.25.1
Requires-Dist: websocket-client>=1.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

TraderMade SDK
==============

tradermade is the Python SDK for getting forex, crypto and CFD data from the TraderMade REST API and WebSocket feed.

Installation
------------

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install tradermade.

```bash

   pip install tradermade
```

Get the API key by signing up for [free](https://tradermade.com/signup).

Usage
-----

REST API

Follow the TraderMade [Python SDK REST tutorial](https://tradermade.com/tutorials/python-sdk-for-forex-data).
```python

   import tradermade as tm

   # set api key
   tm.set_rest_api_key(api_key)


   tm.live(currency='EURUSD,GBPUSD',fields=["bid", "mid", "ask"]) # returns live data - fields is optional
    
   tm.live(currency='EURUSD,GBPUSD',per_quote_ts=True) # returns live data with a timestamp for each quote instead of one for all - per_quote_ts is optional

   tm.historical(currency='EURUSD,GBPUSD', date="2021-04-22",interval="daily", fields=["open", "high", "low","close"]) # returns historical data for the currency requested interval is daily, hourly, minute - fields is optional

   tm.timeseries(currency='EURUSD', start="2021-04-20",end="2021-04-22",interval="hourly",fields=["open", "high", "low","close"]) # returns timeseries data for the currency requested interval is daily, hourly, minute - fields is optional

   tm.timeseries(currency='BTCUSD', start="2026-10-09",end="2026-10-12",interval="daily",weekend=True) # returns timeseries data including weekend days - weekend is optional and works for crypto pairs only

   tm.cfd_list() # gets a list of all cfds available

   tm.currency_list() # gets a list of all currency codes available add two codes to get code for currency pair ex EUR + USD gets EURUSD

```

Streaming Data

Follow the TraderMade [Python SDK WebSocket tutorial](https://tradermade.com/tutorials/stream-data-using-python-in-8-lines-of-code)
```python

   from tradermade import stream

   def print_message(data):
      print(f"Received: {data}")

   api_key = "ws_api_key"

    # set streaming key - not the same as rest API key
   stream.set_ws_key(api_key)

   stream.set_symbols("USDJPY,EURGBP")
   
   # Set the callback for receiving messages
   stream.stream_data(print_message)  

   stream.connect()

   # connects to the WebSocket v2 feed, after login_ok and sub_ack each quote arrives as json with bid/ask volume (bv/av) ex:
   # Received: {"a":"1.122940000","av":"1000000","b":"1.122930000","bv":"1000000","s":"EURUSD","t":"QUOTE","ts":"20261021-12:34:36.202"}
   # see the message format at https://tradermade.com/docs/streaming-data-api

```

Contributing
------------

For changes, please open an issue to discuss what you would like to
change.

License
-------

[MIT](https://choosealicense.com/licenses/mit/)

