def rebalancePortfolio(meta_level_wts, account_id, user_id): # Set environment variables from the .env file env_path = Path("/Users/gdepa") / 'grant_api_keys.env' load_dotenv(env_path) shrimpy_public_key = os.getenv("SHRIMPY_DEV_PUBLIC") shrimpy_private_key = os.getenv("SHRIMPY_DEV_SECRET") shrimpy_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) users = shrimpy_client.list_users() shrimpy_user_id = users[1]['id'] # first id in list of users kraken_id = 39593 shrimpy_client.set_strategy( shrimpy_user_id, kraken_id, { "isDynamic": False, "allocations": [{ "symbol": "XBT", "percent": meta_level_wts[0] }, { "symbol": "USD", "percent": meta_level_wts[1] }, { "symbol": "ETH", "percent": meta_level_wts[2] }] }) shrimpy_client.rebalance(user_id, account_id) # rebalancing to strategy weights
def graph(ticker_symbol): # create the client client = shrimpy.ShrimpyApiClient(publicKey, secretKey) #veiw available credits credits = client.get_credits() nugget = credits print(nugget) instruments = client.get_historical_instruments() # get the candles candles = client.get_candles( # an exchange is a trading platform #USDC will track the us dollar 'kucoin', # exchange ticker_symbol, # base_trading_symbol 'usdc', # quote_trading_symbol '1m', # interval ) # create lists to hold our different data elements dates = [] open_data = [] high_data = [] low_data = [] close_data = [] # convert from the Shrimpy candlesticks to the plotly graph objects format for candle in candles: dates.append(candle['time']) open_data.append(candle['open']) high_data.append(candle['high']) low_data.append(candle['low']) close_data.append(candle['close']) # construct the figure fig = go.Figure(data=[ go.Candlestick(x=dates, open=open_data, high=high_data, low=low_data, close=close_data) ]) # add labels fig.update_layout( title=ticker_symbol, yaxis_title='Price', # shapes = [dict( # x0='2016-12-09', x1='2016-12-09', y0=0, y1=1, xref='x', yref='paper', # line_width=2)], # annotations=[dict( # x='2016-12-09', y=0.05, xref='x', yref='paper', # showarrow=False, xanchor='left', text='Increase Period Begins')] ) # display our graph fig.show()
def run(): global curr public_key = "6e66fa83ece4ca599e32339977647b5a211e0e401057cfd84b298c8dda40acab" private_key = "d416e67e3431d7ad706def03e6228f8dd90bb0d198ae76c7318cf189fab98cb6e51eb285609d1d2c65b79e5dcc2bfec5e97de05b80071391236d15abcee948e3" client = shrimpy.ShrimpyApiClient(public_key, private_key) ticker = client.get_ticker('kucoin') for i in range(0, len(ticker)): curr[ticker[i]["symbol"]] = ticker[i]
def make_client(): try: c = shrimpy.ShrimpyApiClient(os.environ['SHRIMPY_PUBLIC_KEY'], os.environ['SHRIMPY_SECRET_KEY']) return c except AttributeError as e: _logger.error( f"Could not construct Shrimpy API. Public and/or Secret keys not set properly. Error: {e}" ) return None
def refresh(self): #Get data from Shrimpy's API client = shrimpy.ShrimpyApiClient(self.public_key, self.secret_key) self.cdata = pd.DataFrame(client.get_ticker(self.current_exchange)) self.exchanges = pd.DataFrame(client.get_supported_exchanges()) #Currency strings for comboboxes self.currency_strs = list() appendices = list() for i in range(len(self.cdata)): name = self.cdata["name"][i] symbol = self.cdata["symbol"][i] self.currency_strs.append(f"{name} ({symbol})") #Other support hundred_millionth = 0.00000001 if symbol in ["BTC", "ETH", "LTC"]: hmil_usd = np.multiply(float(self.cdata["priceUsd"][i]), hundred_millionth) hmil_btc = np.multiply(float(self.cdata["priceBtc"][i]), hundred_millionth) pchange = self.cdata["percentChange24hUsd"][i] updated = self.cdata["lastUpdated"][i] if symbol == "BTC": appendices.append( pd.DataFrame([[ "Satoshi", "Satoshi", hmil_usd, hmil_btc, pchange, updated ]], columns=self.cdata.columns)) elif symbol == "ETH": appendices.append( pd.DataFrame([[ "Gwei", "Gwei", hmil_usd, hmil_btc, pchange, updated ]], columns=self.cdata.columns)) elif symbol == "LTC": appendices.append( pd.DataFrame([[ "Litoshi", "Litoshi", hmil_usd, hmil_btc, pchange, updated ]], columns=self.cdata.columns)) for df in appendices: self.cdata = self.cdata.append(df, ignore_index=True) name = df["name"][0] symbol = df["symbol"][0] self.currency_strs.append(f"{name} ({symbol})")
def btcWS(): api_client = shrimpy.ShrimpyApiClient(public_key, private_key) raw_token = api_client.get_token() client = shrimpy.ShrimpyWsClient(error_handler, raw_token['token']) #Subscription object subscribe_data = { "type": "subscribe", "exchange": "binance", "pair": "btc-usdt", "channel": "trade" } client.connect() client.subscribe(subscribe_data, handler)
def __init__(self, shrimp_keys, user_data, default_exch=None): self.client = shrimpy.ShrimpyApiClient(shrimp_keys[0], shrimp_keys[1]) self.username = user_data[0] self.user_id = user_data[1] self.set_accounts() if default_exch is None: if len(self.accounts) > 0: account = self.accounts[0] self.default_account_id = account["id"] self.default_account_name = account["exchange"] else: for account in self.accounts: if (default_exch == account["exchange"]): self.default_account_id = account["id"] self.default_account_name = account["exchange"] if self.default_account_name != "NULL": self.default_trading_pairs = self.client.get_trading_pairs( self.default_account_name)
EXCH_PUB_KEY = os.getenv('EXCH_PUB_KEY') EXCH_SEC_KEY = os.getenv('EXCH_SEC_KEY') client = None wsClient_btc_eth = None wsClient_zec_eth = None wsClient_zec_btc = None def error_ws_handler(msg): print("webSocket error: ", msg) print("STOPPING Arbitrage Server") exit(1) if SHRIMPY_PRV_KEY is not None and SHRIMPY_PUB_KEY is not None and EXCH_PUB_KEY is not None and EXCH_SEC_KEY is not None: client = shrimpy.ShrimpyApiClient(SHRIMPY_PUB_KEY, SHRIMPY_PRV_KEY) raw_token_B_E = client.get_token() raw_token_Z_E = client.get_token() raw_token_Z_B = client.get_token() wsClient_btc_eth = shrimpy.ShrimpyWsClient(error_ws_handler, raw_token_B_E['token']) wsClient_zec_eth = shrimpy.ShrimpyWsClient(error_ws_handler, raw_token_Z_E['token']) wsClient_zec_btc = shrimpy.ShrimpyWsClient(error_ws_handler, raw_token_Z_B['token']) else: client = DemoAPIClient() wsClient_btc_eth = demowsclient.DemoWSClient() wsClient_zec_eth = demowsclient.DemoWSClient() wsClient_zec_btc = demowsclient.DemoWSClient() monitorBTC_ETH = currencymonitor.CurrencyMonitor('eth', 'btc', wsClient_btc_eth) monitorZEC_ETH = currencymonitor.CurrencyMonitor('zec', 'eth', wsClient_zec_eth) monitorZEC_BTC = currencymonitor.CurrencyMonitor('zec', 'btc', wsClient_zec_btc)
def fetch_data(): # Set environment variables from the .env file env_path = Path("/Users/gdepa") / 'grant_api_keys.env' load_dotenv(env_path) shrimpy_public_key = os.getenv("SHRIMPY_DEV_PUBLIC") shrimpy_private_key = os.getenv("SHRIMPY_DEV_SECRET") shrimpy_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) users = shrimpy_client.list_users() shrimpy_user_id = users[1]['id'] # first id in list of users kraken_id = 39593 # Retrieve Balance Information From Shrimpy Rest API balance = shrimpy_client.get_balance(shrimpy_user_id, kraken_id) holdings = balance['balances'] asset_balances = [] asset_values_usd = [] asset_values_btc = [] symbols = [] # This is a sample handler, it simply prints the incoming message to the console def error_handler(err): print(err) # Create the websocket client - set up socket communication #api_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) #raw_token = api_client.get_token() #ws_client = shrimpy.ShrimpyWsClient(error_handler, raw_token['token']) # collect asset balances on the exchange balance = shrimpy_client.get_balance(shrimpy_user_id, kraken_id) holdings = balance['balances'] asset_balances = [] asset_values_usd = [] asset_values_btc = [] symbols = [] for asset in holdings: asset_symbol = asset['symbol'] asset_amount = asset['nativeValue'] asset_value_usd = asset['usdValue'] asset_value_btc = asset['btcValue'] asset_balances.append(asset_amount) asset_values_usd.append(asset_value_usd) asset_values_btc.append(asset_value_btc) symbols.append(asset_symbol) balances_df = pd.DataFrame(columns=[ 'symbol', 'asset_balance', 'usd_balance', 'btc_balance', 'wt_of_total_usd', 'wt_of_total_btc' ]) balances_df['symbol'] = symbols balances_df['asset_balance'] = asset_balances balances_df['usd_balance'] = asset_values_usd balances_df['btc_balance'] = asset_values_btc # Save balances to dataframe balances_df = pd.DataFrame(columns=[ 'symbol', 'asset_balance', 'usd_balance', 'btc_balance', 'wt_of_total_usd', 'wt_of_total_btc' ]) balances_df['symbol'] = symbols balances_df['asset_balance'] = asset_balances balances_df['usd_balance'] = asset_values_usd balances_df['btc_balance'] = asset_values_btc total_balance_usd = balances_df['usd_balance'].sum() total_balance_btc = balances_df['btc_balance'].sum() balances_df[ 'wt_of_total_usd'] = balances_df['usd_balance'] / total_balance_usd balances_df[ 'wt_of_total_btc'] = balances_df['btc_balance'] / total_balance_btc # retrieve Price Data exchange = 'kraken' universe_assets = ['XBT', 'USD', 'ETH'] quote_currencies = ['XBT', 'USD'] interval = '6h' start = '2018-01-01' # 1000 candle limit # Get and organize closing prices into dataframe from list of trading pairs from one exchange from shrimpy rest api def calc_trading_pairs_df(exchange): exchange_pairs = shrimpy_client.get_trading_pairs(exchange) exchange_pairs_df = pd.DataFrame(columns=['base', 'quote']) for key, value in enumerate(exchange_pairs): exchange_pairs_df.loc[key] = [ value['baseTradingSymbol'], value['quoteTradingSymbol'] ] return exchange_pairs_df def universe_selection(universe_assets, quote_currencies): trading_pairs_df = calc_trading_pairs_df universe_pairs_df = trading_pairs_df[[ (trading_pairs_df['base'].isin(universe_assets) & trading_pairs_df['quote'].isin(quote_currencies)) ]] return universe_pairs_df def get_universe_prices(exchange, universe_pairs_df, interval, start): universe_prices_df = pd.DataFrame() for index, row in universe_pairs_df.iterrows(): candles = shrimpy_client.get_candles(exchange, row['base'], row['quote'], interval, start) time = [] prices = [] for key, value in enumerate(candles): time.append(value['time']) prices.append(value['close']) prices_df = pd.DataFrame( list(zip(time, prices)), columns=['time', row['base'] + "_" + row['quote']]) prices_df['time'] = pd.to_datetime(prices_df['time']) if universe_prices_df.empty: universe_prices_df = prices_df else: universe_prices_df = pd.merge(universe_prices_df, prices_df, left_on='time', right_on='time', how='left') return universe_prices_df universe_pairs_df = universe_selection(universe_assets, quote_currencies) universe_prices_df = get_universe_prices(exchange, universe_pairs_df, interval, start) # make sure rows are every 6hrs, if there is no row-then make one and forward fill data (shrimpy doesn't print candle if there is no tick) def calc_feature_df(universe_prices_df): ## cumulative returns as velocity ## Log returns as velocity ## partials? ## Lags? ## stock to flow ## Technical Indicators ## Social Indicators df_features = universe_prices_df # Construct dependent variable df_features['returns'] = df_features['close'].pct_change() # Calculate cumulative returns df_features['cum_returns'] = (df_features['returns'] + 1).cumprod() # ----------------------- Price Dynamics -------------------------------- # price dynamics as a one Dimensional particle problem in physics df_features['price_velocity_2'] = df_features['close'].pct_change(2) df_features['price_velocity_3'] = df_features['close'].pct_change(3) df_features['price_velocity_4'] = df_features['close'].pct_change(4) df_features['price_velocity_7'] = df_features['close'].pct_change(7) df_features['price_velocity_30'] = df_features['close'].pct_change(30) df_features['price_acceleration_1'] = df_features[ 'returns'].pct_change(1) df_features['price_acceleration_2'] = df_features[ 'price_velocity_2'].pct_change(2) df_features['price_acceleration_3'] = df_features[ 'price_velocity_3'].pct_change(3) df_features['price_acceleration_4'] = df_features[ 'price_velocity_4'].pct_change(4) df_features['price_acceleration_7'] = df_features[ 'price_velocity_7'].pct_change(7) df_features['price_acceleration_30'] = df_features[ 'price_velocity_30'].pct_change(30) df_features['rolling_mean_velocity_2'] = df_features[ 'returns'].rolling(window=2).mean() df_features['rolling_mean_velocity_3'] = df_features[ 'returns'].rolling(window=3).mean() df_features['rolling_mean_velocity_4'] = df_features[ 'returns'].rolling(window=4).mean() df_features['rolling_mean_velocity_7'] = df_features[ 'returns'].rolling(window=7).mean() df_features['rolling_mean_velocity_30'] = df_features[ 'returns'].rolling(window=30).mean() df_features['rolling_mean_acceleration_2'] = df_features[ 'price_acceleration_1'].rolling(window=2).mean() df_features['rolling_mean_acceleration_3'] = df_features[ 'price_acceleration_1'].rolling(window=3).mean() df_features['rolling_mean_acceleration_4'] = df_features[ 'price_acceleration_1'].rolling(window=4).mean() df_features['rolling_mean_acceleration_7'] = df_features[ 'price_acceleration_1'].rolling(window=7).mean() df_features['rolling_mean_acceleration_30'] = df_features[ 'price_acceleration_1'].rolling(window=30).mean() # To extend space to entire line the log price is mapped to position x(t) in the space by # x(t) = log(S(t)) where S(t) is the price of the instrument df_features['log_price'] = np.log(df_features['close']) df_features['log_returns'] = df_features['log_price'].diff( ) # Diff or percent change #df_features['log_return_pct'] = df_features['log_price'].pct() #df_features['cum_log_returns'] =(df_features['log_returns_pct'] + 1).cumprod() # Assumption: Returns of financial instruments are lognormally distributed # v(t) = R(t) = dx(t)/dt where v(t) is the velocity of the instrument in the log price space, x(t) # ------------------------------ partial price dynamics --------------------- # -------------------------------Technical Indicators ------------------------ df_features.dropna(inplace=True) return df_features df_features = calc_feature_df(universe_prices_df) return universe_prices_df, balances_df, df_features
def __init__(self): self.public_key = '1504fc9bbc22378f703bd6dfb7ca1d8f2cbdfabc67748689285d420d1324d18e' self.private_key = 'f99e4918a855c67faedeebc3f83425a9d727eda2cd70d806f26f0746ba74855e85a633ae10b46973a3b2bf452702b505f859e769cef9e1f7bfe5196bdcbcb490' self.client = shrimpy.ShrimpyApiClient(self.public_key, self.private_key)
import shrimpy import time import argparse api_key = "iZHsmlsCReb9S6zVO05Vxy8ONQYK8J3CfshgNiRh3HlRShPULMj8EYBClftHBqi1" api_secret = "4IHk54oeSmmoXGQqWNgi24SJ1uHaTSEBfN48nOhYex8ATFFOj2WoWZQfDFD0pzu1" client = shrimpy.ShrimpyApiClient(api_key, api_secret) def Scanner(args): count = 0 time_list = [] symbols = ['BNB', 'XRP', 'LTC', 'BTC', 'ETH', 'BCH'] # User Request symbol while True: close = [] ticker = client.get_ticker('binance') count += 1 for req in symbols: for item in ticker: if item['symbol'] == req: close.append(float(item["priceUsd"])) time_list.append(close) if len(time_list) == 21: time_list.pop(0) if len(time_list) <= 5: continue
import json import os #get stored data path = os.path.dirname(__file__) exchangelist = json.load(open(path + "exchanges.json")) credentials = json.load(open(path + "credentials.json")) while True: try: # connect to db dbclient = pymongo.MongoClient("mongodb://localhost:27017/") db = dbclient["crypto"] print("Connected to DB") # connect to api client = shrimpy.ShrimpyApiClient(credentials['public_key'], credentials['secret_key']) # get tradingpairs for exchange print("--tradingpairs--") tradingpairs = [] with dbclient.start_session() as session: i = 0 for exchange in exchangelist: print(exchange['exchange']) tradingpairs.append( client.get_trading_pairs(exchange['exchange'])) time.sleep(2) session.start_transaction() mycol = db[exchange['exchange'] + "_tradingpairs"] mycol.delete_many({}) mycol.insert_many(tradingpairs[i])
import shrimpy import time # Provide the name of the exchange that you need to get trades per second ( it should be # supported by Shrimpy) exchange = 'binance' # Provide the start and end dates start_date = "2020-07-01" end_date = "2020-08-01" # If you have a paid token of Shrimpy include it here. api_client = shrimpy.ShrimpyApiClient("", "") # Here we are getting all the trading pairs of the given exchange and getting it's trade count. trading_pairs = api_client.get_trading_pairs(exchange) total_count = 0 for i in range(len(trading_pairs)): count = api_client.get_historical_count( 'trade', exchange, trading_pairs[i]["baseTradingSymbol"], trading_pairs[i]["quoteTradingSymbol"], start_date + 'T01:00:00.000Z', end_date + 'T02:00:00.000Z') print( "Progress: ", i + 1, "/" + str(len(trading_pairs)) + " Trade Pair Count: " + str(count['count']) + " - " + trading_pairs[i]["baseTradingSymbol"] + "/" + trading_pairs[i]["quoteTradingSymbol"] + " Total Trades: ", total_count) total_count = total_count + count['count'] time.sleep(7) # Remove this sleep if you have paid token from Shrimpy print("Total Trades in one month: {}", total_count) print("Average Trades per second: {}", float(total_count) / float((30 * 24 * 60 * 60)))
import shrimpy shrimpy_public_key = '...' shrimpy_secret_key = '...' client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_secret_key) ticker = client.get_ticker('binance')
###--- IMPORTS ---### import requests import json import pandas as pd import shrimpy import plotly.graph_objects as go import settings ###--- GLOBAL VARIABLES ---### shrimpy_public_key = settings.SHRIMPY_PUBLIC_KEY shrimpy_private_key = settings.SHRIMPY_PRIVATE_KEY client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) ###--- FUNCTIONS ---### def draw_chart(): ''' using API key, create get data, and draw/plotadd chart ''' # candles = client.get_candles( # 'bittrex', # exchange # 'XLM', # base_trading_symbol # 'BTC', # quote_trading_symbol # '15m' # interval # ) re = requests.get( 'https://dev-api.shrimpy.io/v1/exchanges/coinbasepro/candles?quoteTradingSymbol=BTC&baseTradingSymbol=XLM&interval=1H'
import shrimpy def error_handler(err): print(err) def handler(msg): ticker = msg['content'][len(msg['content']) - 1]['price'] print(ticker) public_key = '510a439a466904076cf439307ecf6f53806df78d49c210bac06e83746be2daf4' private_key = '103fb3901b000916f351e0551efbc947baab6fa5f34204459fe0ae74a6d67f5e4e9b5e2319b03f33b57f931fb3aa7331a6de8e14e613f4e4ae11db9175488204' api_client = shrimpy.ShrimpyApiClient(public_key, private_key) raw_token = api_client.get_token() client = shrimpy.ShrimpyWsClient(error_handler, raw_token['token']) subscribe_data = { "type": "subscribe", "exchange": "binance", "pair": "btc-usdt", "channel": "trade" } client.connect() client.subscribe(subscribe_data, handler) client.disconnect()
def fetch_data(): # Set environment variables from the .env file env_path = Path("/Users/gdepa")/'grant_api_keys.env' load_dotenv(env_path) shrimpy_public_key = os.getenv("SHRIMPY_DEV_PUBLIC") shrimpy_private_key = os.getenv("SHRIMPY_DEV_SECRET") shrimpy_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) users = shrimpy_client.list_users() shrimpy_user_id = users[1]['id'] # first id in list of users kraken_id = 39593 # Retrieve Balance Information From Shrimpy Rest API balance = shrimpy_client.get_balance(shrimpy_user_id, kraken_id) holdings = balance['balances'] asset_balances = [] asset_values_usd = [] asset_values_btc = [] symbols = [] # This is a sample handler, it simply prints the incoming message to the console def error_handler(err): print(err) # Create the websocket client - set up socket communication #api_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_private_key) #raw_token = api_client.get_token() #ws_client = shrimpy.ShrimpyWsClient(error_handler, raw_token['token']) # collect asset balances on the exchange balance = shrimpy_client.get_balance(shrimpy_user_id, kraken_id) holdings = balance['balances'] asset_balances = [] asset_values_usd = [] asset_values_btc = [] symbols = [] for asset in holdings: asset_symbol = asset['symbol'] asset_amount = asset['nativeValue'] asset_value_usd = asset['usdValue'] asset_value_btc = asset['btcValue'] asset_balances.append(asset_amount) asset_values_usd.append(asset_value_usd) asset_values_btc.append(asset_value_btc) symbols.append(asset_symbol) balances_df = pd.DataFrame(columns = ['symbol','asset_balance','usd_balance', 'btc_balance', 'wt_of_total_usd', 'wt_of_total_btc']) balances_df['symbol'] = symbols balances_df['asset_balance'] = asset_balances balances_df['usd_balance'] = asset_values_usd balances_df['btc_balance'] = asset_values_btc # Save balances to dataframe balances_df = pd.DataFrame(columns = ['symbol','asset_balance','usd_balance', 'btc_balance', 'wt_of_total_usd', 'wt_of_total_btc']) balances_df['symbol'] = symbols balances_df['asset_balance'] = asset_balances balances_df['usd_balance'] = asset_values_usd balances_df['btc_balance'] = asset_values_btc total_balance_usd = balances_df['usd_balance'].sum() total_balance_btc = balances_df['btc_balance'].sum() balances_df['wt_of_total_usd'] = balances_df['usd_balance']/total_balance_usd balances_df['wt_of_total_btc'] = balances_df['btc_balance']/total_balance_btc # retrieve Price Data exchange = 'kraken' universe_assets = ['XBT', 'USD', 'ETH'] quote_currencies = ['XBT', 'USD'] interval = '6h' start = '2018-01-01' # 1000 candle limit # Get and organize closing prices into dataframe from list of trading pairs from one exchange from shrimpy rest api def calc_trading_pairs_df(exchange): exchange_pairs = shrimpy_client.get_trading_pairs(exchange) exchange_pairs_df = pd.DataFrame(columns=['base','quote']) for key, value in enumerate(exchange_pairs): exchange_pairs_df.loc[key] = [value['baseTradingSymbol'],value['quoteTradingSymbol']] return exchange_pairs_df def universe_selection(universe_assets, quote_currencies): trading_pairs_df = calc_trading_pairs_df universe_pairs_df = trading_pairs_df[(trading_pairs_df['base'].isin(universe_assets) & trading_pairs_df['quote'].isin(quote_currencies))] return universe_pairs_df def get_universe_prices(exchange, universe_pairs_df, interval, start): universe_prices_df = pd.DataFrame() for index, row in universe_pairs_df.iterrows(): candles = shrimpy_client.get_candles(exchange, row['base'], row['quote'], interval, start) time = [] prices = [] for key, value in enumerate(candles): time.append(value['time']) prices.append(value['close']) prices_df = pd.DataFrame(list(zip(time, prices)), columns = ['time', row['base'] + "_" + row['quote']]) prices_df['time'] = pd.to_datetime(prices_df['time']) if universe_prices_df.empty: universe_prices_df = prices_df else: universe_prices_df = pd.merge(universe_prices_df, prices_df, left_on='time', right_on = 'time', how = 'left') return universe_prices_df universe_pairs_df=universe_selection(universe_assets,quote_currencies) universe_prices_df = get_universe_prices(exchange, universe_pairs_df, interval, start) return universe_prices_df, balances_df
import shrimpy public_key = shrimpy_public secret_key = shrimpy_secret client = shrimpy.ShrimpyApiClient(public_key, secret_key) ticker = client.get_ticker('binance') print(ticker) client.get_asset_dominance() # function documentation: https://pypi.org/project/shrimpy-python/