streetyoga / atapi

Backtest, forward test and apply trading algorithms and strategies on binance spot, futures and nft market and other exchanges, including arbitrage.
MIT License
5 stars 5 forks source link

Removing Testnet balance #38

Closed miron closed 2 years ago

miron commented 2 years ago

as they are of no use atm. Mainnet balance still a long way to go. API keys not needed as a lot of work has to be done with statistics.

Instructions on how to setup a your API key for the spot testnet:

Binance Spot API Key

Export as environment variables:

Bash/Sh/Zsh:

export BINANCE_API_KEY='your_api_key'           
export BINANCE_API_SECRET='your_secret_key'      

# Check
echo $BINANCE_API_KEY
echo $BINANCE_API_SECRET

Powershell:

$env:BINANCE_API_KEY = 'your_api_key'          
$env:BINANCE_API_SECRET = 'your_secret_key'    

# Check
$env:BINANCE_API_KEY
$env:BINANCE_API_KEY

from comp/algo.py:

    @staticmethod
    def balance():
        """Balance and kline fields for selected assets."""
        return pd.json_normalize(client_test.account()['balances'])

from __main__.py

    @staticmethod
    def do_balance(arg):
        """Balance and kline fields for selected assets."""
        table = Table('Assets Balance')
        table.add_row(algo_class.balance().astype({'free': 'float', 'locked': 'float'}).to_string(
            float_format=lambda _: '{:.2f}'.format(_), index=False))
        console.print(table)