Exemplo n.º 1
0
	def refreshFees(self):
		for pair in self.logPairs:
			try:
				self.fees[pair] = btceapi.getTradeFee(pair, self.connection)
			except httplib.HTTPException:
				self.refreshConnection()
				return self.refreshFees
			#btce gives fees in %, we want per one
			self.fees[pair]/=100
		self.lgr.log(DEBUG, "Retrieved new fees from btc-e")
		self.lFeesTime = time.time()
Exemplo n.º 2
0
 def __init__(self, pair, key, collectionInterval=1, bufferSpanMinutes=10):
     self.bufferSpanMinutes = bufferSpanMinutes
     handler = btceapi.KeyHandler(key)
     key = handler.getKeys()[0]
     print "Trading with key %s" % key
     self.api = btceapi.TradeAPI(key, handler)
     self.type = pair
     self.fee_adjustment = 1 - float(btceapi.getTradeFee(self.type)) / 10
     self.collectionInterval = collectionInterval
     self.running = False
     self.bidHistory = {}
     self.askHistory = {}
     self.asks = []
     self.bids = []
Exemplo n.º 3
0
#!/usr/bin/python
import btceapi

print("Trading fees:")
connection = btceapi.BTCEConnection()
for pair in btceapi.all_pairs:
    fee = btceapi.getTradeFee(pair, connection)
    print("    %s %.3f %%" % (pair, fee))
Exemplo n.º 4
0
 def getFees(self, pair):
     ''' Retreive current fees on transactions of given pair '''
     connection = btceapi.BTCEConnection()
     self.fee = btceapi.getTradeFee(pair, connection)
     connection.close()
     return self.fee
Exemplo n.º 5
0
aparser.set_defaults(real_trading=False)
args = aparser.parse_args()

keyfile = "keyfile"
keyfile = path.abspath(keyfile)

# One connection for everything
# Init shared data object
shared_data = bot.data.SharedData(
    trading_sum,
    args.real_trading,
    btceapi.common.BTCEConnection(),
)

pair = 'btc_usd'
fee = btceapi.getTradeFee(pair, connection=shared_data.conn)
# API returns fee in percent. Get absolute value
fee /= 100

print("Current fee is", fee)
print("Trading", pair, "pair")
print("EMA", fast, slow)
print("Tick size", res_name)


class ActionTimeout(object):
    """
    Don't instantly act after signal is generated.
    Wait 1/6 of period from last signal change to
    confirm it and actually do what we are supposed to do.
    """
Exemplo n.º 6
0
aparser.add_argument('-r', '--real', dest='real_trading', action="store_true",
                     help='Activate real trading')
aparser.set_defaults(real_trading=False)
args = aparser.parse_args()

keyfile = "keyfile"
keyfile = path.abspath(keyfile)

# One connection for everything
# Init shared data object
shared_data = bot.data.SharedData(trading_sum, args.real_trading,
                                  btceapi.common.BTCEConnection(),
                                  )

pair = 'btc_usd'
fee = btceapi.getTradeFee(pair, connection=shared_data.conn)
# API returns fee in percent. Get absolute value
fee /= 100

print("Current fee is", fee)
print("Trading", pair, "pair")
print("EMA", fast, slow)
print("Tick size", res_name)

class ActionTimeout(object):
    """
    Don't instantly act after signal is generated.
    Wait 1/6 of period from last signal change to
    confirm it and actually do what we are supposed to do.
    """
    def __init__(self, action, res_value):
Exemplo n.º 7
0
 def getTradeFee(pair):
     return btceapi.getTradeFee(pair, settings.connection)