Skip to main content

HistoricalInvestor trading API

Project description

Readme for PyHI module

0. Introduction

This is a Python client for HistoricalInvestor.com server, a financial training tool and trading strategy tester application.

1. Using PyHI client

  1. Log in to HI account using a supported browser (manually) and presuming you have some financial instruments bought, click:

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.

  1. In your program, import the HiData class from “pyhi” module:

from pyhi import HiData, maybe_pretty

  1. Create main instance of the HiData class that will be a HI client, for instance

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))

  1. Transactions

To buy, use positive values (long position) in “volume” parameter.

To sell, use negative values (long position) in “volume” parameter.

  1. close the session with .finish

or else the transactions will not be visible

  1. open executed session in web UI:

  • click Autosys | automaton name (e.g. “MyAutomaton” in “test.py” example) | date and time of the session.

  1. click Results button to view the trade results.

Button Trades turns on buy/sell transaction labels on the main chart.

4. Example

A complete client use example is available in a file “example.py” located in “doc “ subdirectory.

5. Important issues

Remember to close the session with “finish” method of HiData instance - otherwise the session with transactions done will not be shown in web UI!

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

pyhi-0.2.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file pyhi-0.2.tar.gz.

File metadata

  • Download URL: pyhi-0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyhi-0.2.tar.gz
Algorithm Hash digest
SHA256 8eafbb389786c20fb1fe006e32a03a3ec3d669b8c1665bec31092226acab233f
MD5 00a0bb07dffe9cfb9cbf09481b85172f
BLAKE2b-256 5a5bfe3fe1ae82c9f1a7542dc5310bb829290d0b646fe2ada54b61169e0e3785

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page