Skip to main content

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!

Metadata

Release files for pyhi 0.2

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

Source distribution (sdist)

Source distribution for pyhi 0.2
File Size Uploaded Provenance
pyhi-0.2.tar.gz 3.7 kB Without provenance Details

Release files / pyhi-0.2.tar.gz

Download URL pyhi-0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8eafbb389786c20fb1fe006e32a03a3ec3d669b8c1665bec31092226acab233f
BLAKE2b-256 checksum
How to use checksums
5a5bfe3fe1ae82c9f1a7542dc5310bb829290d0b646fe2ada54b61169e0e3785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyhi 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

0.1

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