Exemple #1
0
 def test_DEEP_too_many_syms(self):
     with pytest.raises(ValueError):
         get_market_deep(["AAPL", "TSLA"])
Exemple #2
0
 def test_DEEP_pandas(self):
     with pytest.raises(ValueError):
         get_market_deep("AAPL", output_format='pandas')
Exemple #3
0
    def test_DEEP_json_syms(self):
        js = get_market_deep("AAPL")

        assert isinstance(js, dict)
Exemple #4
0
 def test_DEEP_json_default(self):
     with pytest.raises(ValueError):
         get_market_deep()
Exemple #5
0
    def test_DEEP_json_syms(self):
        js = get_market_deep("AAPL")
        js2 = get_market_deep(["AAPL", "TSLA"])

        assert isinstance(js, dict)
        assert isinstance(js2, dict)
Exemple #6
0
from iexfinance import get_market_book, get_market_deep, get_historical_data
from datetime import datetime
import matplotlib.pyplot as plt
import json
import sched, time
import csv

# start = datetime(2018, 3, 15)
# end = datetime(2018, 4, 24)

# df = get_historical_data("AAPL", start, end, 'json')
# datetime.strftime(df['timestamp'], '%Y-%m-%dT%H:%M:%S.%f')

df = get_market_deep("amzn,googl,goog,msft,fb,intc,csco,nvda,nflx,jpm", 'json')
# json_f = open('/NN/Historical Data/IEX/AAPL_DEEP_Test.json')
# df = json.load(json_f)

csv_f = csv.writer(open("test_other_stocks.csv", 'w', newline=''))

header = df.keys()
csv_f.writerow(header)
csv_f.writerow(df.values())

# starttime = time.time()
# while True:
#   df = get_market_deep("amzn,googl,goog,msft,fb,intc,csco,nvda,nflx", 'json')
#   csv_f.writerow(df.values())
#   print("Recorded at: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()))
#   time.sleep(5.0 - ((time.time() - starttime) % 5.0))

# print(json.dumps(df, indent=4, sort_keys=True))