INNER CODE UNIT · Python
enter_position
liamhartley/cryptotradingbot · trading_strategies/coinbase_cmo_trading_strategy/app/payload/app.py:64
def enter_position(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('----- entering position -----')
print(f'entry_amount: {amount}')
print(f'rate: {rate}')
print(f'ticker: {pair}')
if LOGICAL_PARAMS["DRY_RUN"] is False:
response = coinbase_wrapper.buy(# price=str(rate), not required for a market order
size=str(round(amount, 8)),
order_type='market',
product_id=pair)