def nomics(): # Note; This is a test API key. Not to be used for personal use api_key = '408cc5e9c771ca59fce4f0f27457a24a' import os, os.path import sys sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from nomics import Nomics return Nomics(api_key)
def nomics(): return Nomics(NOMICS_API_KEY)
import os, os.path import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))) from nomics import Nomics import json api_key = '408cc5e9c771ca59fce4f0f27457a24a' nomics = Nomics(api_key) print(" - Currencies") response = nomics.get_currencies() print("Get Currencies: \n", response[:5], "\n") response = nomics.get_prices()[0] print("Get Prices: \n", json.dumps(response, indent = 4), "\n") response = nomics.get_all_time_highs()[1] print("Get All Time Highs: \n", json.dumps(response, indent = 4), "\n") response = nomics.get_supplies_interval(start = '2018-01-01')[0] print("Get Supplies Interval: \n", json.dumps(response, indent = 4), "\n") response = nomics.get_currencies_interval(start = '2018-01-01')[0] print("Get Currencies Interval: \n", json.dumps(response, indent = 4), "\n") response = nomics.get_markets()[0] print("Get Markets: \n", json.dumps(response, indent = 4), "\n")
#https://github.com/TaylorFacen/nomics-python/wiki/Currencies#get-sparkline # cd into Documents/Environments # source crypto_env/bin/activate from nomics import Nomics import pandas as pd import numpy as np api_key = '1be400cebde55adc62e1fddc88618feb' nomics = Nomics(api_key) #markets = nomics.Markets.get_markets(exchange = 'binance') #print(markets) # ex_rate = nomics.ExchangeRates.get_history( # currency = "ADA", # start = "2021-03-01T00:00:00Z", # end = "2021-04-02T00:00:00Z" # ) #print(ex_rate) #curr = nomics.Currencies.get_currencies(ids = "VTX") sp = nomics.Currencies.get_sparkline(start="2019-01-01T00:00:00Z") df = pd.DataFrame(sp)
import time import sched from datetime import datetime, timedelta, date import os from dotenv import load_dotenv from nomics import Nomics load_dotenv() apiKey = os.getenv('API_KEY') nomics = Nomics(apiKey) print(nomics.Currencies.get_currencies(ids="BTC", interval="1h")) allStocks = [] class Player(): def __init__(self, name, allocatedCapital): self.name = name self.allocatedCapital = allocatedCapital self.availableCapital = allocatedCapital self.strategies = [] self.positions = [] self.completedTrades = [] self.profit = 0 def AllocateCapital(self, proposedCapital): if self.availableCapital - proposedCapital < 0 or self.availableCapital == 0: return -1 self.availableCapital -= proposedCapital return proposedCapital