GBM Plus API Python Library
Project description
GBM Plus API Python Library
The GBM Plus API Python library aims to provide all current API calls to interface with the GBM Plus/Homebroker platform.
Setup
-
Get the CLIENT_ID from the GBM Plus login dashboard
-
Keep your USER_EMAIL, USER_PASSWORD and CLIENT_ID safe and secure. You can use environment variables for development.
-
Install the latest version of Python 3
-
Use pip (or an alternative such as easy_install) to install the library from the Python Package Index:
pip install gbmplus- If you have both Python3 and Python2 installed, you may need to use
pip3(sopip3 install gbmplus) along withpython3on your system - If gbmplus was previously installed, you can upgrade to the latest non-beta release with
pip install --upgrade gbmplus
Usage
-
Export your USER_EMAIL, USER_PASSWORD and CLIENT_ID as environment variables, for example:
Linux
export USER_EMAIL="xxxxxx@xxxxx.com" export USER_PASSWORD="shabadabadashabadabadaenelcentrodelplaneta" export CLIENT_ID="xxxxxxxxxxxxxxxxxxx"
Windows Powershell
$env:USER_EMAIL="xxxxxx@xxxxx.com" $env:USER_PASSWORD="shabadabadashabadabadaolvidadoenlabanqueta" $env:CLIENT_ID="xxxxxxxxxxxxxxxxxxx"
-
Alternatively, define your USER_EMAIL, USER_PASSWORD and CLIENT_ID as variables in your source code; this method is not recommended due to its inherent insecurity.
-
Single line of code to import and use the library goes at the top of your script:
import gbmplus
-
Instantiate the client (API consumer class), optionally specifying any of the parameters available to set:
trader_object = gbmplus.GBMPlusAPI(output_log=False)
-
Make API calls in your source code, using the format client.scope.operation, where client is the name you defined in the previous step (trader_object above), scope is the corresponding scope that represents a module, and operation is the operation of the API endpoint. For example, to make a call to get the list of Accounts (or Strategies), use this function call:
accounts = trader_object.accounts.getAccounts() print(accounts)
Examples
You can find working example scripts in the examples folder.
| Script | Purpose |
|---|---|
| transfer.py | Transfer from the Smart Cash strategy to a target strategy |
| submitOrder.py | Submit a buy order, issuer: FUNO 11, trading type: market, instrument_type: IPC |
| tradingUSAExample.py | Submit a buy order with Trading USA, ticker: AMZN |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gbmplus-0.12.tar.gz.
File metadata
- Download URL: gbmplus-0.12.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63eaa95e5716808aeec39b26ed2b1fef76569adc474a721284da52831cbf834f
|
|
| MD5 |
61360eb437633707cb6134306a399f4d
|
|
| BLAKE2b-256 |
278df454381bd2a5561bf4a1f2b45a85007c693a40d6780b7bc30ae031171c6d
|
File details
Details for the file gbmplus-0.12-py3-none-any.whl.
File metadata
- Download URL: gbmplus-0.12-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8956b85fbf8594a761ff355fec8c9b46efe47399b377121ecf871ad73f52022f
|
|
| MD5 |
751622ce0ccca5ce0667d33ead5cfe85
|
|
| BLAKE2b-256 |
6fb4818ebb1b940f303493484d0994df1e9d064eabfdf22358f4f06631d2d541
|