INNER CODE UNIT · Python

close_positions

liamhartley/cryptotradingbot · trading_strategies/coinbase_cmo_trading_strategy/app/payload/app.py:28

def close_positions(coinbase_wrapper, pair, rate, amount):
    '''

    :param currency_pair: A string that defines the market, "ETH-USDC" for example.
    :param rate: The price. Units are market quote currency. Eg ETH-USDC market, the value of this field would be around 10,000. Naturally this will be dated quickly but should give the idea.
    :param amount: The total amount offered in this buy order.
    :return:
    '''
    print('----- closing position -----')
    print(f'entry_amount: {amount}')
    print(f'rate: {rate}')
    print(f'ticker: {pair}')

    # base_currency = LOGICAL_PARAMS['PAIR'].split('-')[0]
    quote_currency = LOGICAL_PARAMS['PAIR'].split('-')[1]

    # if we have any of our quote_currency
    if float(get_balance(coinbase_wrapper, ticker=quote_currency)['balance']) > 0 and LOGICAL_PARAMS["DRY_RUN"] is False:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…