Skip to main content

Python client for connecting to LORA Technologies' bot services.

Project description

LORA Technologies Bot Client

Client for LORA Tech's bot services.

Example
A working example script that you can try can be found at https://github.com/asklora/Droid-Client/blob/production/example_usage.py

Usage:

Bot Creation

Client.create_bot(args, **kwargs)

Args:
    ticker (str): cRIC code for which stock to create a bot for
    spot_date (str): Date for bot creations.
    investment_amount (float): Amount of cash the bot can use.
    bot_id (str): The type of bot to use (e.g. CLASSIC_classic_025)

Kwargs:
    margin (int): Amount of margin the bot is allowed to use. Defaults to 1.
    price (float): Price of the stock (any currency). Defaults to None (current price).
    fractionals (bool): Whether the bot should use fractional shares. Defaults to False.

Returns:
    dict: Parsed bot service response.
        {
            ticker (str),                 # RIC code
            share_num (float),            # Number of shares bought
            expiry (str),                 # Date of expiry
            spot_date (str),              # [For internal use]
            created (str),                # Date of bot creation
            total_bot_share_num (int),    # Number of shares held by this bot
            max_loss_pct (float),         # 
            max_loss_price (float),       # 
            max_loss_amount (float),      # 
            target_profit_pct (float),    # 
            target_profit_price (float),  # 
            target_profit_amount (float), # 
            entry_price (float),          # Price of stock when this bot was created
            margin (int),                 # Amount of margin this bot is allowed to use
            bot_id (str),                 # This bot's bot type
            fractionals (bool),           # Whether this bot is allowed to use fractional shares
            side (str),                   # 
            status (str),                 # Status of this bot (i.e. active)
            vol (float),                  # 
            classic_vol (float),          # 
            strike_2 (int),               # 
            barrier (int),                # 
            delta (int),                  # 
            option_price (int),           # 
            q (int),                      # 
            r (int),                      # 
            strike (int),                 # 
            t (int),                      # 
            v1 (int),                     # 
            v2 (int),                     # 
        }

Hedging using an existing bot

Client.hedge(*args, **kwargs)

Args:
    bot_id (str): Type of bot.
    ticker (str): RIC code.
    current_price (float): Current price (any currency).
    entry_price (float): Price when the bot was created.
    last_share_num (float): Number of shares currently held by the bot.
    last_hedge_delta (float): Number of shares last sold/bought by the bot.
    investment_amount (float): Total cash value the bot is allowed to manage.
    bot_cash_balance (float): Remaining cash the bot has.
    stop_loss_price (float): Stop loss level of the bot.
    take_profit_price (float): Take profit level of the bot.
    expiry (str): Date when the bot expires.

Kwargs:
    strike (Optional[float]): _description_. Defaults to None.
    strike_2 (Optional[float]): _description_. Defaults to None.
    margin (Optional[int]): Amount of margin the bot can use. Defaults to 1.
    fractionals (Optional[bool]): Whether this bot is allowed to use fractional shares. Defaults to False.
    option_price (Optional[float]): _description_. Defaults to None.
    barrier (Optional[float]): _description_. Defaults to None.
    current_low_price (Optional[float]): _description_. Defaults to None.
    current_high_price (Optional[float]): _description_. Defaults to None.
    ask_price (Optional[float]): _description_. Defaults to None.
    bid_price (Optional[float]): _description_. Defaults to None.
    trading_day (Optional[str]): _description_. Defaults to datetime.strftime(datetime.now().date(), "%Y-%m-%d  ").

Returns:
    dict: Parsed bot service response
        {
            entry_price (float),       # 
            current_price (float),     # Current price of stock
            share_num (float),         # 
            total_bot_share_num (int), # 
            last_hedge_delta (int),    # 
            share_change (int),        # 
            side (str),                # 
            status (str),              # 
            strike_2 (int),            # 
            barrier (int),             # 
            delta (int),               # 
            option_price (int),        # 
            q (int),                   # 
            r (int),                   # 
            strike (int),              # 
            t (int),                   # 
            v1 (int),                  # 
            v2 (int),                  # 
        }

Stopping a bot

Client.stop(*args, **kwargs)

Args:
    bot_id (str): Type of bot.
    ticker (str): RIC code.
    current_price (float): Current price (any currency).
    entry_price (float): Price when the bot was created.
    last_share_num (float): Number of shares currently held by the bot.
    last_hedge_delta (float): Number of shares last sold/bought by the bot.
    investment_amount (float): Total cash value the bot is allowed to manage.
    bot_cash_balance (float): Remaining cash the bot has.
    stop_loss_price (float): Stop loss level of the bot.
    take_profit_price (float): Take profit level of the bot.
    expiry (str): Date when the bot expires.

Kwargs:
    strike (Optional[float]): _description_. Defaults to None.
    strike_2 (Optional[float]): _description_. Defaults to None.
    margin (Optional[int]): Amount of margin the bot can use. Defaults to 1.
    fractionals (Optional[bool]): Whether this bot is allowed to use fractional shares. Defaults to False.
    option_price (Optional[float]): _description_. Defaults to None.
    barrier (Optional[float]): _description_. Defaults to None.
    current_low_price (Optional[float]): _description_. Defaults to None.
    current_high_price (Optional[float]): _description_. Defaults to None.
    ask_price (Optional[float]): _description_. Defaults to None.
    bid_price (Optional[float]): _description_. Defaults to None.
    trading_day (Optional[str]): _description_. Defaults to datetime.strftime(datetime.now().date(), "%Y-%m-%d  ").

Returns:
    dict: Parsed bot service response
        {
            entry_price (float),       # 
            current_price (float),     # Current price of stock
            share_num (float),         # 
            total_bot_share_num (int), # 
            last_hedge_delta (int),    # 
            share_change (int),        # 
            side (str),                # 
            status (str),              # 
            strike_2 (int),            # 
            barrier (int),             # 
            delta (int),               # 
            option_price (int),        # 
            q (int),                   # 
            r (int),                   # 
            strike (int),              # 
            t (int),                   # 
            v1 (int),                  # 
            v2 (int),                  # 
        }

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

LoraDroidClient-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

LoraDroidClient-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file LoraDroidClient-0.1.0.tar.gz.

File metadata

  • Download URL: LoraDroidClient-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for LoraDroidClient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f593325ec8903ba1e0004a9b3eaa3a3f5148c7bac7857ab0c57d152459c55cfd
MD5 f9de63a44541a540acaf682476acd1a1
BLAKE2b-256 1f93c117b70d715154d8399025dfbff08d07151dd14018f9c4220be6770b599d

See more details on using hashes here.

File details

Details for the file LoraDroidClient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: LoraDroidClient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for LoraDroidClient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51c34ea72e5e6bb638ceaba068464856b1cb985d5637e2854b6bbb6706827d02
MD5 95872614a34333485696139e2f8f427e
BLAKE2b-256 533261abe306534c06f712c125b30a966365cb213ea0f722ded84895c7b6c04e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page