def new_gemini_order(amount, price, side, symbol): con = Geminipy(api_key=API_KEY, secret_key=SECRET_KEY, live=False) order = con.new_order(amount=amount, price=price, side=side, symbol=symbol) return order.json()
def __init__(self, config): try: self.client = Geminipy.AuthenticatedClient(config['key'], config['secret'], config['passphrase']) print('Connected to Gemini.') except: print('Could not connect to Gemini.')
def main(): gem = Geminipy(api_key="72x9myrMio2LKMuyWxVR", secret_key="Ywujy3nNLBncuvWxfj9bryNSZpM") a = gem.symbols() c = gem.price(symbol='btcusd') d = gem.new_order(amount="5", price="3528.85", side="buy", client_order_id="3424", symbol='btcusd', type='exchange limit', options=["maker-or-cancel"]) e = gem.book(symbol='btcusd', limit_asks=0, limit_bids=0) anum = int(input("Please enter a number"))
import gdax import time, json, requests import arrow from geminipy import Geminipy print "GDAX & Gemini Arbitrage Trading Bot v1.2" print "created 9/1/2017 == xxx" start_time = arrow.now() print "Start Time:", start_time """ GET bid & asking prices """ con = Geminipy(api_key='xxx', secret_key='xxx', live=True) gem_ticker_url = 'https://api.gemini.com/v1/pubticker/ethbtc' auth_client = gdax.AuthenticatedClient('xxx', 'xxx', 'xxx') public_client = gdax.PublicClient() gdax_ticker_url = 'https://api.gdax.com/products/ETH-BTC/ticker' while True: def gem_bid(): ticker = requests.get(gem_ticker_url) return ticker.json() ['bid'] def gem_ask(): ticker = requests.get(gem_ticker_url) return ticker.json() ['ask']
# Withdraw an asset to a specific address # " import csv #variables to store the API for each exchange GDAX = gdax.PublicClient() my_gdax = gdax.AuthenticatedClient( 'afb5c86acff788d5f92f11464778b3fc', 'bhG2QcCgdYhxUrdYtaGC2RI6rgZ/3nnD4iIk44fkm1ddLflIA5MESMfiAVF7FM3LAe0NFJ8LJ3O3kM+1eCUXgA==', 'phrigmphragm69') polo = Poloniex( 'VVON608N-R94HR9YS-IBLCJJPZ-SZ6BNQO9', 'f122cbc7d88c083b9c60483d6d7be5637b8ba808812bafa678fb87d6a04a5ae5d54b3b7dc04422366e41bbfc5e491f073a2b328c8a453918c7537c48ef465311' ) Bitfinex = bitfinex.Client() gem = Geminipy(api_key='', secret_key='', live=True) my_bittrex = Bittrex('2a1e0d61c5804c1fa2f36f7bd5abe293', '98558cc7b793450d8290630010550994', api_version=API_V2_0) poloBalance = polo.returnBalances() print(polo.returnTicker()['BTC_ETH']) # print(Bitfinex.ticker('ETHBTC')) #" # AUTHENTICATION - DO NOT F**K WITH THIS # " print("polo call")
gdax_buy_price = (float(GDAXBID()) + 0.00001) gdax_sell_price = (float(GDAXASK()) - 0.00001) def gdax_buy_order(): auth_client.buy(price=gdax_buy_price, size=0.01, product_id='ETH-BTC') def gdax_sell_order(): auth_client.sell(price=gdax_sell_price, size=0.01, product_id='ETH-BTC') #GEMINI con = Geminipy(api_key='ivrwpKOnNKTNCcLNvvwV', secret_key='Ti3rdGhuTcXsYQPxGixCgTdw4z2', live=True) gem_buy_price = (float(geminiBID()) + 0.00001) gem_sell_price = (float(geminiASK()) - 0.00001) def gem_buy_order(): order = con.new_order(amount=0.01, price=gem_buy_price, side='buy') def gem_sell_order(): order = con.new_order(amount=0.01, price=gem_sell_price, side='sell') gdax_buy_order()
def get_args(): parser = argparse.ArgumentParser() parser.add_argument("--usd_to_spend", help='The amount of USD to use to buy BTC') parser.add_argument( "--btc_to_withdraw", nargs=2, help= 'The amount of BTC to withdraw and the address to withdraw to (ex: .01 1HDLnpVFgqgnfiKjxJUPmb82P7XamASuZf)' ) parser.add_argument("gemini_api_key", help='Get this from gemini.com') parser.add_argument("gemini_api_secret", help='Get this from gemini.com') args = parser.parse_args() return args args = get_args() con = Geminipy(api_key=args.gemini_api_key, secret_key=args.gemini_api_secret, live=True) if args.usd_to_spend: usd_to_spend = Decimal(args.usd_to_spend) spend_usd(con, usd_to_spend) if args.btc_to_withdraw: btc_amount = Decimal(args.btc_to_withdraw[0]).quantize( Decimal('1.00000000')) withdrawl_address = args.btc_to_withdraw[1] withdraw_btc(con, btc_amount, withdrawl_address)
import math from binance.client import Client from binance.enums import * from geminipy import Geminipy from dotenv import load_dotenv load_dotenv() # api_key = os.getenv("BINANCE_API_KEY") # api_secret = os.getenv("BINANCE_API_SECRET") # client = Client(api_key, api_secret) api_key = os.getenv("GEMINI_SANDBOX_API_KEY") api_secret = os.getenv("GEMINI_SANDBOX_API_SECRET") con = Geminipy(api_key=api_key, secret_key=api_secret) def sell_order(current_btc_risk, current_price, from_currency, to_currency, risk_cool_off_value): # this needs to be the initial amount of btc btc_holding = float( client.get_asset_balance(asset=from_currency).get('free')) slo_div = 0.0753 + 0.0897 * math.log(current_btc_risk) slo_btc_amount = float(format(btc_holding * slo_div, ".5f")) slo_price = math.floor(current_price - 500) print('Looking for previous orders') old_order = client.get_open_orders(symbol=from_currency + to_currency) if old_order: old_order_id = old_order[0].get('orderId') print('Order found with id {}'.format(old_order_id))
from geminipy import Geminipy con = Geminipy(api_key='xxx', secret_key='xxx', live=True) symbols = con.symbols() book = con.book() x = 0.079 def gem_buy_order(): order = con.new_order(amount=0.01, price=x, side='buy') gem_buy_order()
import bitstamp.client import time, json, requests import arrow from geminipy import Geminipy print "Bitstamp & Gemini Arbitrage Trading Bot v1.0" print "created 8/30/2017 == xxx" start_time = arrow.now() print "Start Time:", start_time con = Geminipy(api_key='ivrwpKOnNKTNCcLNvvwV', secret_key='xxx', live=True) gem_ticker_url = 'https://api.gemini.com/v1/pubticker/ethbtc' bit_public_client = bitstamp.client.Public() bit_trading_client = bitstamp.client.Trading(username='******', key='xxx', secret='xxx') while True: def gem_bid(): ticker = requests.get(gem_ticker_url) return ticker.json()['bid'] def gem_ask(): ticker = requests.get(gem_ticker_url) return ticker.json()['ask'] bit_bid = bit_public_client.ticker()['bid'] bit_ask = bit_public_client.ticker()['ask']