コード例 #1
0
ファイル: cmbx.py プロジェクト: GSng/bit-master
class CMBX(Exchange):
    def __init__(self):
        Exchange.__init__(self)
        self.cbx_extern = CampBX(keys.CAMPBX_LOGIN, keys.CAMPBX_PASS)
        self.cbx_extern.debug_mode(True)
        self.name = "CampBX"

    def getTicker(self):
        self.ticker = self.cbx_extern.xticker()
        self.timestamp = time.time()
        self.ticker_price = self.ticker["Last Trade"]

    def getOrderBook(self):
        orderBook = self.cbx_extern.xdepth()
        self.orderBook.asks = orderBook["Asks"]
        self.orderBook.bids = orderBook["Bids"]

    # Authenticated Calls
    def getBalance(self):
        my_funds = self.cbx_extern.my_funds()
        print my_funds
        self.balance.usd = my_funds["Liquid USD"]
        self.balance.btc = my_funds["Liquid BTC"]
        # TODO Not implemented open orders

    def trade(self, typ, rate, amount):
        mode = ""
        if typ == "sell":
            mode = "QuickSell"
        elif typ == "buy":
            mode = "QuickBuy"
        self.cbx_extern.trade_enter({"TradeMode": mode, "Quantity": str(amount), "Price": str(rate)})
コード例 #2
0
ファイル: cmbx.py プロジェクト: GSng/bit-master
class CMBX(Exchange):
    def __init__(self):
        Exchange.__init__(self)
        self.cbx_extern = CampBX(keys.CAMPBX_LOGIN, keys.CAMPBX_PASS)
        self.cbx_extern.debug_mode(True)
        self.name = 'CampBX'

    def getTicker(self):
        self.ticker = self.cbx_extern.xticker()
        self.timestamp = time.time()
        self.ticker_price = self.ticker['Last Trade']

    def getOrderBook(self):
        orderBook = self.cbx_extern.xdepth()
        self.orderBook.asks = orderBook['Asks']
        self.orderBook.bids = orderBook['Bids']

    #Authenticated Calls
    def getBalance(self):
        my_funds = self.cbx_extern.my_funds()
        print my_funds
        self.balance.usd = my_funds['Liquid USD']
        self.balance.btc = my_funds['Liquid BTC']
        #TODO Not implemented open orders

    def trade(self, typ, rate, amount):
        mode = ''
        if typ == 'sell':
            mode = 'QuickSell'
        elif typ == 'buy':
            mode = 'QuickBuy'
        self.cbx_extern.trade_enter({
            'TradeMode': mode,
            'Quantity': str(amount),
            'Price': str(rate)
        })
コード例 #3
0
ファイル: cmbx.py プロジェクト: GSng/bit-master
 def __init__(self):
     Exchange.__init__(self)
     self.cbx_extern = CampBX(keys.CAMPBX_LOGIN, keys.CAMPBX_PASS)
     self.cbx_extern.debug_mode(True)
     self.name = 'CampBX'
コード例 #4
0
ファイル: cmbx.py プロジェクト: GSng/bit-master
 def __init__(self):
     Exchange.__init__(self)
     self.cbx_extern = CampBX(keys.CAMPBX_LOGIN, keys.CAMPBX_PASS)
     self.cbx_extern.debug_mode(True)
     self.name = "CampBX"