Exemplo n.º 1
0
 def __init__(self, apiKey, secretKey):
     if Bitfinex.__instance != None:
         raise Exception("This class is a singleton.")
     else:
         Bitfinex.__instance = self
         self._bitfinex = bitfinexpy.API(environment="live",
                                         key=apiKey,
                                         secret_key=secretKey)
Exemplo n.º 2
0
def order_buy(apikey, apisecret, ammount, symbol, price):
    bitfinex = bitfinexpy.API(environment="live",
                              key=apikey,
                              secret_key=apisecret)
    rr = bitfinex.new_order(symbol=symbol,
                            amount=ammount,
                            price=price,
                            side="buy",
                            type="limit")
    return (rr.id, '1')
Exemplo n.º 3
0
def sum(apikey, apisecret, valet1, valet2):
    sum = 0
    bitfinex = bitfinexpy.API(environment="live",
                              key=apikey,
                              secret_key=apisecret)
    rr = bitfinex.wallet_balances()
    for i in range(0, len(rr)):
        skr = str(rr[i]['currency']).upper()
        if skr == valet1 or skr == valet2:
            payload = {'fsym': skr, 'tsyms': 'USD'}
            r = requests.get('https://min-api.cryptocompare.com/data/price',
                             params=payload)
            r = r.json()
            sum = sum + (float(r['USD']) * float(rr[i]['amount']))
    return (sum)
Exemplo n.º 4
0
def cancel(symbol, id, orid, apikey, apisecret):
    bitfinex = bitfinexpy.API(environment="live",
                              key=apikey,
                              secret_key=apisecret)
    bitfinex.cancel_order(order_id=id)
import bitfinexpy, time

# PARAMS USER #
KEY = 'AI KEY'
SECRET_KEY = 'API SECRET KEY'
bitfinex = bitfinexpy.API(environment="live", key=KEY, secret_key=SECRET_KEY)
MARGEN_PRECIO = 0.0000005
cantidad = 100
PRECIO_OBJETIVO = 0.0000254
#PRECIO_MÍNIMO = PRECIO_OBJETIVO - MARGEN_PRECIO (NORMALMENTE)
PRECIO_MÍNIMO = 0.0000249
PRECIO_LÍMITE = 0.0000249
precio = 100
mercado = 'iotbtc'
peticiones = 0 
segundos = 0
segundos=int(time.strftime('%S'))
segundos=segundos+(int(time.strftime('%M'))*60)
segundos=segundos+(int(time.strftime('%H'))*3600)


#TICKER BID, ASK
def price_bid_ask(mercado):
    global peticiones
    global segundos
    peticiones=peticiones+1
    print('peticiones=')
    print(peticiones)
    print(time.strftime('%H:%M:%S'))
    #print(time.strftime('%H'))
    #time.sleep(60)
Exemplo n.º 6
0
        while True:
            tick = self.algobank.GetInstancePrice(EXCHANGE, MERCHANDISE)
            if tick != '':
                _tick = json.loads(tick)
                self.cur_time = dt.fromtimestamp(float(_tick['timestamp']))
                self.ask_price = float(_tick['ask'])
                self.bid_price = float(_tick['bid'])
                self.cur_price = float(_tick['last_price'])
                self.cur_volume = float(_tick['volume'])

                self.update_data()
                self.update_signal(self.marketdata.hour.tail(81))
                self.condition_to_close()
                self.condition_to_overweight()
                self.condition_to_open()


if __name__ == '__main__':
    algobank = AlgoBank()

    result = algobank.LOGIN(00000000, 'aaaaa', '123456')

    if result['result']:
        btf = bitfinexpy.API(environment='live',
                             key='xxxxxxxxxxxxxxx',
                             secret_key='xxxxxxxxxxxxxxx')
        algo = ETH_algo15(algobank, btf)
        algo.run()
    else:
        Logs('Login failed')