This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pycoingecko import CoinGeckoAPI | |
| import datetime as dt | |
| # today in Timestamp | |
| today = dt.datetime.today() | |
| today_unix = today.timestamp() | |
| # today minus 100 days in Timestamp | |
| today_minus_100 = today - dt.timedelta(days=100) | |
| today_minus_100_unix = today_minus_100.timestamp() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| colorAPIResponse = {'result': [[252, 236, 177], [225, 195, 67], [248, 65, 32], [145, 43, 75], [68, 43, 87]]} | |
| # Parse each color from the colorAPIResponse and print it out. | |
| for color in colorAPIResponse['result']: | |
| print(color) | |
| # >> | |
| # [252, 236, 177] | |
| # [225, 195, 67] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # AccuEeather API call example 5 Day Forecast for | |
| # Mexico City Code: 242560 | |
| response = {'Headline': {'EffectiveDate': '2022-05-14T08:00:00-05:00', 'EffectiveEpochDate': 1652533200, 'Severity': 4, 'Text': 'Pleasant this weekend', 'Category': 'mild', 'EndDate': None, 'EndEpochDate': None, 'MobileLink': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?lang=en-us', 'Link': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?lang=en-us'}, 'DailyForecasts': [{'Date': '2022-05-11T07:00:00-05:00', 'EpochDate': 1652270400, 'Temperature': {'Minimum': {'Value': 54.0, 'Unit': 'F', 'UnitType': 18}, 'Maximum': {'Value': 79.0, 'Unit': 'F', 'UnitType': 18}}, 'Day': {'Icon': 3, 'IconPhrase': 'Partly sunny', 'HasPrecipitation': False}, 'Night': {'Icon': 33, 'IconPhrase': 'Clear', 'HasPrecipitation': False}, 'Sources': ['AccuWeather'], 'MobileLink': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?day=1&lang=en-us', 'Link': 'htt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # AccuEeather API call example 5 Day Forecast for | |
| # Mexico City Code: 242560 | |
| response = {'Headline': {'EffectiveDate': '2022-05-14T08:00:00-05:00', 'EffectiveEpochDate': 1652533200, 'Severity': 4, 'Text': 'Pleasant this weekend', 'Category': 'mild', 'EndDate': None, 'EndEpochDate': None, 'MobileLink': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?lang=en-us', 'Link': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?lang=en-us'}, 'DailyForecasts': [{'Date': '2022-05-11T07:00:00-05:00', 'EpochDate': 1652270400, 'Temperature': {'Minimum': {'Value': 54.0, 'Unit': 'F', 'UnitType': 18}, 'Maximum': {'Value': 79.0, 'Unit': 'F', 'UnitType': 18}}, 'Day': {'Icon': 3, 'IconPhrase': 'Partly sunny', 'HasPrecipitation': False}, 'Night': {'Icon': 33, 'IconPhrase': 'Clear', 'HasPrecipitation': False}, 'Sources': ['AccuWeather'], 'MobileLink': 'http://www.accuweather.com/en/mx/mexico-city/242560/daily-weather-forecast/242560?day=1&lang=en-us', 'Link': 'htt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pycoingecko import CoinGeckoAPI | |
| cg = CoinGeckoAPI() | |
| currentBTCPrice = cg.get_price(ids='bitcoin', vs_currencies='usd') | |
| print(currentBTCPrice) | |
| # >> {'bitcoin': {'usd': 29202}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yfinance as yf | |
| # DEFINE TICKER FOR APPLE | |
| aapl = yf.Ticker("AAPL") | |
| # GET HISTORICAL TRADING DATA | |
| print(aapl.history(period="max")) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # AccuWeather API call example 5 Day Forecast for | |
| # Mexico City Code: 242560 | |
| import requests | |
| url = "http://dataservice.accuweather.com/forecasts/v1/daily/5day/242560?apikey=YOURAPIKEY" | |
| resp = requests.get(url) | |
| if resp.status_code == 200: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from requests.structures import CaseInsensitiveDict | |
| # ENDPOINT: | |
| url = "http://colormind.io/api/" | |
| # Request Format | |
| headers = CaseInsensitiveDict() | |
| headers["Content-Type"] = "application/json" | |
| data = '{"model":"default"}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Pyplot in the Browser</title> | |
| <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
| <script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
| <py-env> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" | |
| crossorigin="anonymous"> | |
| <script defer src="https://pyscript.net/alpha/pyscript.js"></script> |