コード例 #1
0
import json
from models.CoinbasePro import AuthAPI

with open('config.json') as config_file:
    config = json.load(config_file)

model = AuthAPI(config['api_key'], config['api_secret'], config['api_pass'], config['api_url'])
resp = model.authAPI('GET','orders?status=all')
print (resp)

accounts = model.getAccounts()
print (accounts)

#account = model.getAccount('00000000-0000-0000-0000-000000000000')
#print (account)

orders1 = model.getOrders()
print (orders1)

orders2 = model.getOrders('BTC-GBP')
print (orders2)

orders3 = model.getOrders('BTC-GBP', 'buy')
print (orders3)

orders4 = model.getOrders('BTC-GBP', 'buy', 'done')
print (orders4)

#order = model.marketBuy('BTC-GBP', 100)
#print (order)
コード例 #2
0
                            round(df_sell['price'], 2)
                        ]],
                        columns=[
                            'status', 'market', 'buy_at', 'buy_type',
                            'buy_size', 'buy_value', 'buy_fees',
                            'buy_with_fees', 'buy_price', 'sell_at',
                            'sell_type', 'sell_size', 'sell_value',
                            'sell_fees', 'sell_minus_fees', 'sell_price'
                        ])

                    df_tracker = df_tracker.append(df_pair, ignore_index=True)
                    pair = 0

                last_action = row['action']

            fees = api.authAPI('GET', 'fees')
            maker_fee_rate = float(
                fees['maker_fee_rate'].to_string(index=False).strip())
            taker_fee_rate = float(
                fees['taker_fee_rate'].to_string(index=False).strip())

            if len(orders) > 0:
                last_order = orders.iloc[-1:]
                last_buy_order = last_order[last_order.action == 'buy']
                last_buy_order = last_buy_order.reset_index(drop=True)

                if len(last_buy_order) > 0:
                    print(last_buy_order.to_string(index=False))

                    market = last_buy_order['market'].to_string(
                        index=False).strip()