Exemplo n.º 1
0
    def __init__(self, pair_code, api_key=None, api_secret=None):
        base_currency, market_currency = self.get_tradeable_pairs(pair_code)

        super().__init__(base_currency, market_currency, pair_code)

        self.client = bittrex.Bittrex(
            api_key if api_key else config.Bittrex_API_KEY,
            api_secret if api_secret else config.Bittrex_SECRET_TOKEN)
Exemplo n.º 2
0
    def __init__(self, api_key=None, api_secret=None):
        super().__init__("BTC", "BCH", "BTC-BCC")

        self.trade_client = bittrex.Bittrex(
            api_key if api_key else config.Bittrex_API_KEY,
            api_secret if api_secret else config.Bittrex_SECRET_TOKEN)

        self.get_balances()
Exemplo n.º 3
0
 def __init__(self, daemons, credentials):
     self.daemons = daemons
     self.out = {}
     self.api = {}
     for i, exch in enumerate(credentials):
         if (exch == "cryptsy"):
             self.api[exch] = PyCryptsy(str(credentials[exch]["pubkey"]),
                                        str(credentials[exch]["privkey"]))
         elif (exch == "bittrex"):
             self.api[exch] = Bittrex.Bittrex(
                 str(credentials[exch]["pubkey"]),
                 str(credentials[exch]["privkey"]))
         elif (exch == "c-cex"):
             self.api[exch] = PyCCEX(str(credentials[exch]["key"]))
         elif (exch == "cryptopia"):
             self.api[exch] = PyCryptopia()
         elif (exch == "poloniex"):
             self.api[exch] = poloniex(str(credentials[exch]["key"]),
                                       str(credentials[exch]["secret"]))
         elif (exch == "bleutrade"):
             self.api[exch] = bleuBot(str(credentials[exch]["key"]),
                                      str(credentials[exch]["secret"]))
         else:
             raise ValueError("unknown exchange")
Exemplo n.º 4
0
    def __init__(self, base_currency, market_currency, pair_code):
        super().__init__(base_currency, market_currency, pair_code)

        self.client = bittrex.Bittrex('','')
Exemplo n.º 5
0
    def __init__(self, base_currency, market_currency, pair_code):
        super().__init__(base_currency, market_currency, pair_code, 0.0025)

        self.client = bittrex.Bittrex(None, None)
Exemplo n.º 6
0
    def __init__(self, pair_code, api_key=None, api_secret=None):
        base_currency, market_currency = self.get_tradeable_pairs(pair_code)

        super().__init__(base_currency, market_currency, pair_code)

        self.client = bittrex.Bittrex(api_key, api_secret)
Exemplo n.º 7
0
    logger.info(
        "------------------------------- CONFIGURATION --------------------------------"
    )
    logger.info(
        "------------------------------------------------------------------------------"
    )

    exchange = {}
    orderbook = {}
    orderbook_raw = {}
    exchange['Gatecoin'] = gatecoin.Gatecoin(
        "https://api.gatecoin.com", strategy_config.gatecoin['public'],
        strategy_config.gatecoin['private'])
    orderbook['Gatecoin'] = {}

    exchange['Bittrex'] = bittrex.Bittrex(strategy_config.bittrex['public'],
                                          strategy_config.bittrex['private'])
    orderbook['Bittrex'] = {}

    exchange['Liqui'] = liqui.Liqui(strategy_config.liqui['public'],
                                    strategy_config.liqui['private'])
    orderbook['Liqui'] = {}

    currency_pairs = strategy_config.currency_pairs
    one_bp_in_pourcent = strategy_config.one_bp_in_pourcent

    logger.info(
        "------------------------------------------------------------------------------"
    )
    logger.info(
        "-------------------------------- PROCESSING ----------------------------------"
    )
from bittrex import bittrex
from tkinter import *
import datetime
import webbrowser

btx2 = bittrex.Bittrex(None, None, api_version=bittrex.API_V2_0)


def market_market(market):
    """Opens the order page of the specified market.

    Args:
            market: An unfiltered string containing the market and its price change. i.e. 16% BTC-NXT
    """
    market = market.split()[1]
    webbrowser.open(
        "https://bittrex.com/Market/Index?MarketName={}".format(market), new=0)


def update_candidate_markets(listbox, date_label, time_label):
    """Finds candidate markets (markets with 10% or greater daily price change).

    Args:
            listbox: The list to store the candidate markets.
            date_label: The date of this procedure's latest execution. 
            time_label: The time of this procedure's latest execution.
    """
    listbox.delete(0, END)

    result = btx2.get_market_summaries()
Exemplo n.º 9
0
from SIF import db_access

# Find the time difference between latest db entry and newest entry
from datetime import datetime
import time
fmt = '%Y-%m-%d %H:%M:%S'

###################################################################
# Bittrex python wrapper and necessary parameters to establish connection

from bittrex_v2 import Bittrex
b_1 = Bittrex(api_key="f4db35970a6f459298e2bb59977f9edc",
              api_secret="588fd5526c9d4ea7bc09909f93563fc9")

import bittrex.bittrex as bt
b_2 = bt.Bittrex("f4db35970a6f459298e2bb59977f9edc",
                 "588fd5526c9d4ea7bc09909f93563fc9")

###################################################################


# Slice dictionary by the entry in it
def sliceDict(d, s):
    return {k: v for k, v in d.items() if k.startswith(s)}


# Function that can extract digits out of string, even when digits are in scientific form
def extractNums(string):

    match_number = re.compile('-?\ *[0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?')
    final_list = [float(x) for x in re.findall(match_number, string)]
Exemplo n.º 10
0
#!/usr/bin/python
from bittrex import bittrex
from database import DataBase
from bittrex_utils import Currency, MarketSummary
import threading

api_key = ""
api_secret = ""

api_key2 = ""
api_secret2 = ""
Exchange = bittrex.Bittrex(api_key, api_secret)

DB = DataBase(
    host="",  # your host, usually localhost
    user="******",  # your username
    passwd="",  # your password
    db="crypto")  # name of the data base

import constants as c


def track_currency_value(delimeter="BTC"):
    threading.Timer(5.0, track_currency_value).start()
    market_summaries = Exchange.get_market_summaries()[c.RESULT]
    currencies = []
    bitcoin_usd_value = float(0)
    for currency in market_summaries:
        symbol_buy = currency["MarketName"].split("-")[0]
        symbol_sell = currency["MarketName"].split("-")[1]
        if (symbol_buy == delimeter and symbol_sell in c.top_100):
'''
  A command line application to trade cryptocurrencies using the Bittrex API
  Written by Andre V. Banks
  Use at your own risk
'''

from bittrex import bittrex as B
import urllib.request
import json
from functools import reduce
from urllib.parse import quote
from coinmarketcap import Market as CMC
import sys
from secrets import BKEY, BSECRET

account = B.Bittrex(BKEY,BSECRET)

BUY_ORDERBOOK = 'buy'
SELL_ORDERBOOK = 'sell'
BOTH_ORDERBOOK = 'both'
LOT = 5 # Amount in dollars the default trade size should be

CMC = CMC()


def find_invested_currencies():
    '''
    Find the currencies in Bittrex where balance > 0 
    rtype: list of dict
    '''
    invested = []
Exemplo n.º 12
0
	def __init__(self, api_key, secret_key):
		''' Use API_V1_1 to get market summary as API_V2_0's equivalent method is buggy '''
		self.btx1 = bittrex.Bittrex(api_key, secret_key, api_version = bittrex.API_V1_1)
		self.btx2 = bittrex.Bittrex(api_key, secret_key, api_version = bittrex.API_V2_0)
Exemplo n.º 13
0
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
from bittrex import bittrex

f = open('config.txt', 'r')
identity = f.readline().split()[2]
password = f.readline().split()[2]
key = f.readline().split()[2]
secret = f.readline().split()[2]
deposit = f.readline().split()[2]
f.close()
bet = str(float(deposit) / 4)

bot = bittrex.Bittrex(key, secret)


class Hermes(LineReceiver):
    def lineReceived(self, line):
        self.handle_COMMAND(line)

    def handle_COMMAND(self, command):
        data = command.decode().split()
        if not data:
            return
        if data[0] != password:
            self.sendLine((identity + ': ' + 'Wrong password').encode())
        else:
            data.remove(data[0])
            if data[0] == 'buy':
Exemplo n.º 14
0
    def __init__(self, pair_code):
        base_currency, market_currency = self.get_tradeable_pairs(pair_code)

        super().__init__(base_currency, market_currency, pair_code, 0.0025)

        self.client = bittrex.Bittrex(None, None)
from bittrex import bittrex
from datetime import datetime
import json
import time
import os

with open("key.json", "r") as in_file:
    keys = json.load(in_file)
    api_key = keys["api"]
    secret_key = keys["secret"]

btx1 = bittrex.Bittrex(api_key, secret_key, api_version=bittrex.API_V1_1)
btx2 = bittrex.Bittrex(api_key, secret_key, api_version=bittrex.API_V2_0)

ORDERSTATE_SELL_LIMIT = "ORDERSTATE_SELL_LIMIT"
ORDERSTATE_STOP_LOSS = "ORDERSTATE_STOP_LOSS"

with open("order.json", "r") as in_file:
    order = json.load(in_file)

while True:
    ''' Identify which order rate is nearer to the last price of the market '''
    result = btx1.get_marketsummary(order["market"])

    if not result["success"]:
        print("[" + result["message"] + "]")
        quit()

    last_price = result["result"][0]["Last"]

    stoploss_lastprice_diff = abs(
Exemplo n.º 16
0
file_dir = os.path.dirname(__file__)
sys.path.append(file_dir)

# Miscellaneous functions in here
from SIF import db_access, misc

import time

# Useful plotting functions:

# Bittrex python wrapper and necessary parameters to establish connection
from bittrex_v2 import Bittrex
b_1 = Bittrex(api_key="key", api_secret="secret")

import bittrex.bittrex as bt
b_2 = bt.Bittrex("key", "secret")
#############################################################################################
# Zcash, Waves, Etherium, NEO, ark, omisego, litecoin, lisk, ripple, monero to BTC
curr_pairs = ("BTC_ZEC", "BTC_WAVES", "BTC_ETH", "BTC_NEO", "BTC_ARK",
              "BTC_OMG", "BTC_LTC", "BTC_LSK", "BTC_XRP", "BTC_XMR")
# Retrieve balance and find how much can be given for each coin (equal amount for now)
curDiv = misc.formatBalance('BTC', 0) / len(curr_pairs)
latestSell = 10000000  # Arbitrarily large value to ensure successful first sale
# Array to store parameters associated with each currency:
# [1] - price that the currency has been last sold for
# [2] - B or S indicating Bought or Sold respectively
storeMoneyList = [['ZEC', latestSell, 'S'], ['WAVES', latestSell, 'S'],
                  ['ETH', latestSell, 'S'], ['NEO', latestSell, 'S'],
                  ['ARK', latestSell, 'S'], ['OMG', latestSell, 'S'],
                  ['LTC', latestSell, 'S'], ['LSK', latestSell, 'S'],
                  ['XRP', latestSell, 'S'], ['XMR', latestSell, 'S']]
Exemplo n.º 17
0
import json
import os
import time

import glob
import numpy as np
import pandas as pd

from bittrex import bittrex
import credentials

client = bittrex.Bittrex(credentials.BITTREX_KEY, credentials.BITTREX_SECRET)
portfolio_filename = os.path.join('data', 'portfolio_{}.csv')


class Portfolio(object):
    """
    A portfolio is the type and amount of each cryptocurrency held.
    There is a desired 'state' and due to fluctuations some currencies will have more (or less) total_value than their
    desired target 'state'. We'll rebalance them periodically.
    To avoid spending too much in commissions when rebalancing we have a 'threshold' and we only 'rebalance
    cryptocurrencies that increased (or decreased) more than 'threshold' (as a percentage) from desired 'state'.
    For example if the desired state is 100 and the threshold is 0.1 we'll sell only if the current total_value is at
    or above 110 (and buy if the current total_value is at or below 90)
    To prevent from buying too much of a sinking currency we are going to put bounds on either the price and/or the
    quantities (not clear yet). One idea is to compute the ratio between the current balance and the initial balance
    per currency and then say that no currency can have a ratio that is N times bigger than the average ratio.
    """
    def __init__(self, portfolio=None):
        """
        Read portfolio from API
Exemplo n.º 18
0
import time

from bittrex import bittrex
from cursesmenu import *
from cursesmenu.items import *

my_bittrex = bittrex.Bittrex("b91292ec5202437599f1382ebf8dd77a",
                             "b7ade1e83bd74313a3f3324c189aa97e")


def loop_open_order(market, marketbtc):
    open_order = my_bittrex.get_open_orders(marketbtc)['result']
    for i in range(len(open_order)):
        type_order = open_order[i]['OrderType']
        return str(type_order)


def pump():
    print("Bot_PUMP")
    balance_dispo = my_bittrex.get_balance("BTC")['result']['Balance']
    print("Voici la balance disponible: " + str(balance_dispo))
    montant_achat = float(
        input("Merci de renseigner le montant d'achat desirée en btc: ")
    )  # BTC/ASK
    pourcent_ask = float(
        input(
            "Merci de renseigner le pourcentage en plus du ask desirée(1.xx): "
        ))
    pourcent_vente = float(
        input("Merci de renseigner le pourcentage de vente desirée(1.xx): "))
    market = input("Selectionner la crypto monnaie: ")