A Computer Science student who wanted to automate basic spot trading based on certain parameters. This algorithm is designed to prevent losses and take profits. 4 Major exchanges supported. Note: I am not maintaining this project.
Stores the current updated price information of a cryptocurrency-pair.
Creates non-blocking threads and retreives updated cryptocurrency-pair price information every interval.
Parameters:
- Stagger: Instance of the Stagger class (described below).
- PriceStruct: Instance of the CurrentPriceStruct class (described above).
- interval: Interval at which a request would be sent for updated price information.
Involves all the business logic involving the actual buying and selling of a cryptocurrency pair.
Parameters:
- breakeven: Initial breakeven threshold at which the algorithm starts. If blank, will be set to current cryptocurrency-pair price * (1 + taker fee)
- margin: Decimal value that the algorithm will buy/sell at based on the current cryptocurrency-pair price.
- crypto_amount: The amount of crypto you want this algorithm to trade with.
- crypto_pair: The cryptocurrency-pair you want to trade.
- timestr: Current time string.
- Client: The exchange client class initialized with your public and private keys.
- PriceStruct: The CurrentPriceStruct class.
- taker_fee: The fee attributed with your exchange/account.
from base import FtxClient import ftxapi from Stagger import Stagger from PriceTickerRest import PriceTickerRest from Stagger import CurrentPriceStructClient = FtxClient(api_key=ftxapi.api_key, api_secret=ftxapi.api_secret, subaccount_name=ftxapi.subaccount_name)
taker_fee = Client.get_account_info()['takerFee'] crypto_pair = Client.SYMBOL_LINK crypto_amount = 3
instance_currentprice = CurrentPriceStruct() instance_stagger = Stagger(crypto_pair=crypto_pair, Client=Client, PriceStruct=instance_currentprice, taker_fee=taker_fee, margin=0.005, crypto_amount=crypto_amount) instance_priceticker = PriceTickerRest( instance_stagger, instance_currentprice) instance_stagger.price_init() while True: instance_stagger.sell_check() instance_stagger.buy_check()
Started selling 3 LINK at +-0.005 (0.5%) minimum intervals and finished at 3.01 LINK while the price of LINK increased. Note: All trades have to be profitable factoring in the exchange taker fee.