Exemplo n.º 1
0
 def test_commit_buy(self):
   client = Client(api_key, api_secret)
   buy = client.commit_buy('foo', 'bar')
   self.assertIsInstance(buy, Buy)
   self.assertEqual(buy, mock_item)
Exemplo n.º 2
0
 def test_commit_buy(self):
     client = Client(api_key, api_secret)
     buy = client.commit_buy('foo', 'bar')
     self.assertIsInstance(buy, Buy)
     self.assertEqual(buy, mock_item)
Exemplo n.º 3
0
    ]

    if "12:00" in date_time_C:
        #insert hourly data into the database
        Database.Database.WriteHourlyData(data)

        #I can trade only to coinbase because I cannot open a ba
        if (abs_dif_per > threshold):
            if (buy_BTCUSD < buy_BTCUSD_KRW):
                #Buy bitcoins on Coinbase
                client.buy(account_id, amount='1', currency='BTC')

                #Commit buy
                #You only need to do this if the initial buy was explictly uncommitted
                buy = account.buy(amount='1', currency='BTC', commit=False)
                client.commit_buy(account_id, buy.id)

                #Sell bitcoins on Bithumb
                #documenation not clear ...
            else:
                #Sell bitcoins on Coinbase
                client.sell(account_id, amount='1', currency='BTC')
                # Commit buy
                # You only need to do this if the initial buy was explictly uncommitted
                sell = account.sell(amount='1', currency='BTC', commit=False)
                client.commit_sell(account_id, sell.id)

                #Buy bitcoins on Bithumb
                #documentation not clear ...
            Database.Database.WriteOrders()