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

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.11.tar.gz (9.9 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.11-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file gbmplus-0.11.tar.gz.

File metadata

  • Download URL: gbmplus-0.11.tar.gz
  • Upload date:
  • Size: 9.9 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.11.tar.gz
Algorithm Hash digest
SHA256 c374b0106ed2abfb2e8ecacca6c81988d09a0707a61272627fa9faf339d6cf1d
MD5 fc7c476712407783653c2b971bc667e9
BLAKE2b-256 6d11891399f104fc871e5e9a17b6c6ab4b2ea662069d62112ad2bf43b8555573

See more details on using hashes here.

File details

Details for the file gbmplus-0.11-py3-none-any.whl.

File metadata

  • Download URL: gbmplus-0.11-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 fb51286bfe39a9eb646d1d1c5eeac7d204fe1a98a76850ecf61baaf6279ab5b4
MD5 059c9d7402340442d0cea110434c1e9c
BLAKE2b-256 ec7a69b64f905066e4d72647517c7ed36481f158bc307b69259902c3e91335e0

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