コード例 #1
0
ファイル: arbitrage.py プロジェクト: laisee/hokonui
    def ticker(sleeptime, lock):
        while True:
            lock.acquire()
            askItBit = itb.get_current_ask('USD')
            bidItBit = itb.get_current_bid('USD')
            askBitfinex = bfx.get_current_ask('USD')
            bidBitfinex = bfx.get_current_bid('USD')
            print "itBit    : Bid %s Ask %s" % (format(Decimal(bid),'.2f'),format(Decimal(ask),'.2f'))
            print "Bitfinex : Bid %s Ask %s" % (format(Decimal(bid),'.2f'),format(Decimal(ask),'.2f'))
            print '-'*20

            # check for Arb in one direction (buy @ ItBit, sell @ Bitfinex)
            if askItBit < bidBitfinex: # can we buy for 100 on ItBit and sell for 101 on Bitfinex?
                arb = bidBitfinex - askItBit 
                print "Arb #1 exists : ITBIT sell price < Bitfinex buy price "  
                print "Amount        : %s " % format(Decimal(arb),'.2f')

            # check for arb in the other direction (buy @ Bitfinex, sell @ ItBit)
            if bidItBit > askBitfinex: # can we buy for 100 on Bitfinex and sell for 101 on ItBit?
                arb = askBitfinex - bidItBit 
                print "Arb #2 exists : Bitfinex sell price < itBit buy price "  
                print "Amount        : %s " % format(Decimal(arb),'.2f')

            lock.release()
            time.sleep(sleeptime)
コード例 #2
0
ファイル: get_bidask.py プロジェクト: laisee/hokonui
def main():
        """main function, called at the start of the program"""

        print '-'*20
        askBitfinex = bfx.get_current_ask('USD')
        bidBitfinex = bfx.get_current_bid('USD')
        print "Bitfinex : Bid %s Ask %s" % (format(Decimal(bid),'.2f'),format(Decimal(ask),'.2f'))
        print '-'*20
コード例 #3
0
ファイル: testbfx.py プロジェクト: laisee/hokonui
 def test_bid(cls):
     ''' Method for testing bid price '''
     ok_(bfx.get_current_bid(base.CCY_DEFAULT) > 0.00)