HistoricalInvestor trading API
This is a Python client for HistoricalInvestor.com server, a financial training tool and trading strategy tester application.
Autosys | REST API
This window contains credentials for your HI client:
REST ID: REST Password:
Copy those credentials to your trading automaton configuration.
The window also lists the symbols of available financial instruments you can trade using the client API.
from pyhi import HiData, maybe_pretty
hd = HiData(restid, restpasswd, ‘AUDJPY’, resolution=’D1’, initialTime=1245803300000, baseurl=’http://historicalinvestor.com’)
The client attempts to open the session to the HI server automatically on creation. It remembers specified parameters like session token, restId and restPassword.
You can call object methods to operate on the virtual market session: getting data, placing orders and closing session.
Example of getting data:
print ‘nnDATA acquired:’, maybe_pretty(hd.get_data(1245803500000, 5))
Placing order for 1 lot of AUDJPY:
print ‘nnOrder:’, maybe_pretty(hd.order(1245803500000, 1))
To buy, use positive values (long position) in “volume” parameter.
To sell, use negative values (long position) in “volume” parameter.
or else the transactions will not be visible
Button Trades turns on buy/sell transaction labels on the main chart.
A complete client use example is available in a file “example.py” located in “doc ” subdirectory.
Remember to close the session with “finish” method of HiData instance - otherwise the session with transactions done will not be shown in web UI!