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 |
Release files for gbmplus 0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gbmplus-0.12.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gbmplus-0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / gbmplus-0.12.tar.gz
| Download URL | gbmplus-0.12.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63eaa95e5716808aeec39b26ed2b1fef76569adc474a721284da52831cbf834f
|
|
BLAKE2b-256 checksum How to use checksums |
278df454381bd2a5561bf4a1f2b45a85007c693a40d6780b7bc30ae031171c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / gbmplus-0.12-py3-none-any.whl
| Download URL | gbmplus-0.12-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8956b85fbf8594a761ff355fec8c9b46efe47399b377121ecf871ad73f52022f
|
|
BLAKE2b-256 checksum How to use checksums |
6fb4818ebb1b940f303493484d0994df1e9d064eabfdf22358f4f06631d2d541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|