class BitstampExchange(Exchange): def __init__(self, settings): super(BitstampExchange, self).__init__(settings) bs = settings['BITSTAMP'] self._trading = TradingClient( username = bs['username'], key = bs['api']['key'], secret = bs['api']['secret']) self._public = PublicClient() ''' How much can you buy a coin for, fee included for the exchange ''' def _buy_price(self): ticker = self._public.ticker() balance = self._trading.account_balance() base_price = float(ticker['ask']) fee = float(balance['fee']) return base_price + ((fee / 100) * base_price) ''' How much can you get if you sell a coin, fee subtracted ''' def _sell_price(self): ticker = self._public.ticker() balance = self._trading.account_balance() base_price = float(ticker['bid']) fee = float(balance['fee']) return base_price - ((fee / 100) * base_price)
def __init__(self, settings): super(BitstampExchange, self).__init__(settings) bs = settings['BITSTAMP'] self._trading = TradingClient( username = bs['username'], key = bs['api']['key'], secret = bs['api']['secret']) self._public = PublicClient()
from binance.client import Client from bitstamp.client import Public from openpyxl import load_workbook, Workbook from openpyxl.chart import Reference, LineChart from openpyxl.chart.axis import DateAxis from openpyxl.styles import Border, Side, Font import time import datetime init_money = FILL_IN binance_key = FILL_IN binance_secret = FILL_IN binance_client = Client(binance_key, binance_secret) bitstamp_public_client = Public() binance_fee = 0.050 / 100 bitstamp_fee = 0.25 / 100 ETH_withdrawal_fee = 0.01000000 def main(): try: wb = load_workbook("Crypto.xlsx") except FileNotFoundError: wb = Workbook() wb.remove_sheet(wb["Sheet"]) wb.create_sheet("Data") wb.create_sheet("Charts") wb.create_sheet("Totaal")