Skip to main content

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

  1. Get the CLIENT_ID from the GBM Plus login dashboard (Where to find client_id screenshot) Navigate to Github repository to view image

  2. Keep your USER_EMAIL, USER_PASSWORD and CLIENT_ID safe and secure. You can use environment variables for development.

  3. Install the latest version of Python 3

  4. 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 (so pip3 install gbmplus) along with python3 on your system
    • If gbmplus was previously installed, you can upgrade to the latest non-beta release with pip install --upgrade gbmplus

Usage

  1. 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"
    
  2. 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.

  3. Single line of code to import and use the library goes at the top of your script:

    import gbmplus
    
  4. Instantiate the client (API consumer class), optionally specifying any of the parameters available to set:

    trader_object = gbmplus.GBMPlusAPI(output_log=False)
    
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbmplus-0.12.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbmplus-0.12-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for gbmplus-0.12.tar.gz
Algorithm Hash digest
SHA256 63eaa95e5716808aeec39b26ed2b1fef76569adc474a721284da52831cbf834f
MD5 61360eb437633707cb6134306a399f4d
BLAKE2b-256 278df454381bd2a5561bf4a1f2b45a85007c693a40d6780b7bc30ae031171c6d

See more details on using hashes here.

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

Hashes for gbmplus-0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8956b85fbf8594a761ff355fec8c9b46efe47399b377121ecf871ad73f52022f
MD5 751622ce0ccca5ce0667d33ead5cfe85
BLAKE2b-256 6fb4818ebb1b940f303493484d0994df1e9d064eabfdf22358f4f06631d2d541

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