StatArb / StatBot / BONUS / config_bonus_api.py
config_bonus_api.py
Raw
"""
    API DOCUMENTATION
    https://bybit-exchange.github.io/docs/linear/#t-introduction
"""
# Get cointegrated pair
# import sys
# sys.path
# import main_strategy
# sym_1, sym_1_price_decimals, sym_1_qty_decimals, sym_2, sym_2_price_decimals, sym_2_qty_decimals = main_strategy.perform_strategy()

# API Imports
from psutil import net_io_counters
from pybit import HTTP

# CONFIG VARIABLES
mode = "test"

ticker_1 = "LINKUSDT"
ticker_2 = "STORJUSDT"
signal_positive_ticker = ticker_2
signal_negative_ticker = ticker_1
rounding_ticker_1 = 3
rounding_ticker_2 = 4
quantity_rounding_ticker_1 = 0
quantity_rounding_ticker_2 = 0

# ticker_1 = sym_1 #"BCHUSDT"
# ticker_2 = sym_2 #"XNOUSDT"
# signal_positive_ticker = sym_2 # ticker_2
# signal_negative_ticker = sym_1 # ticker_1
# rounding_ticker_1 = sym_1_price_decimals #2
# rounding_ticker_2 = sym_2_price_decimals #3
# quantity_rounding_ticker_1 = sym_1_qty_decimals #2
# quantity_rounding_ticker_2 = sym_2_qty_decimals #1

max_loss_usdt_total = -250

limit_order_basis = False # Will ensure positions (except for Close) will be placed on limit basis

tradeable_capital_usdt = 1000 # total tradeable capital to be split between both pairs
max_trades_per_signal = 5 # total number of trades per ticker
stop_loss_fail_safe = 0.5 # stop loss at market order in case of drastic event
signal_trigger_thresh = 0.6 # Z-Score threshold which determines trade (must be above zero)

timeframe = 60 # make sure matches your strategy
kline_limit = 200 # make sure matches your strategy
z_score_window = 21 # make sure matches your strategy


n_step = False # enable n-step
n_interval = 1 # e.g. exit positions in 1 hr

# LIVE API
api_key_mainnet = ""
api_secret_mainnet = ""

# TESTNET API
api_key_testnet = <Bybit Testnet API key>
api_secret_testnet = <Bybit Testnet Secret key>

# SELECTED API
api_key = api_key_testnet if mode == "test" else api_key_mainnet
api_secret = api_secret_testnet if mode == "test" else api_secret_mainnet

# SELECTED API
api_url = "https://api-testnet.bybit.com" if mode == "test" else "https://api.bybit.com"
ws_public_url = "wss://stream-testnet.bybit.com/realtime_public" if mode == "test" else "wss://stream.bybit.com/realtime_public"
ws_private_url = "wss://stream-testnet.bybit.com/realtime_private" if mode == "test" else "wss://stream.bybit.com/realtime_private"

# SESSION Activation
session_public = HTTP(api_url)
session_private = HTTP(api_url, api_key=api_key, api_secret=api_secret)