Skip to content

Commit

Permalink
Edit output format slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderSales committed Aug 25, 2023
1 parent fa87249 commit 9c6ade5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
api_key = os.getenv("POLYGON_API_KEY")

# From Polygon.io
ticker = 'C:EURUSD' # Note the ticker format for currency pairs
ticker = 'C:EURUSD'
sma_url = f"https://api.polygon.io/v1/indicators/sma/{ticker}?timespan=day&adjusted=true&window=50&series_type=close&order=desc&apiKey={api_key}"

# Make the SMA API request
Expand All @@ -19,9 +19,12 @@
# Check if the request was successful
if sma_response.status_code == 200:
sma_data = sma_response.json()
# Process the SMA data as needed
print("SMA Data:")
print(sma_data)
# Process and display the SMA data
if 'results' in sma_data:
for timestamp, sma_value in sma_data['results'].items():
print(f"Timestamp: {timestamp}, SMA Value: {sma_value}")
else:
print("No SMA data found in the response.")
else:
print(f"SMA request failed with status code: {sma_response.status_code}")

Expand Down

0 comments on commit 9c6ade5

Please sign in to comment.