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
| pragma solidity ^0.6.0; | |
| import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/interfaces/AggregatorInterface.sol"; | |
| contract ReferenceConsumer { | |
| AggregatorInterface internal ref; | |
| /** | |
| * @dev Ropsten example _aggregator: | |
| * @dev ETH/USD feed: 0x8468b2bDCE073A157E560AA4D9CcF6dB1DB98507 |
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
| pragma solidity ^0.6.0; | |
| import "github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
| // MyContract inherits the ChainlinkClient contract to gain the | |
| // functionality of creating Chainlink requests | |
| contract ChainlinkExample is ChainlinkClient { | |
| // Stores the answer from the Chainlink oracle | |
| uint256 public currentPrice; | |
| address public owner; |
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
| pragma solidity ^0.6.0; | |
| import "github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
| // MyContract inherits the ChainlinkClient contract to gain the | |
| // functionality of creating Chainlink requests | |
| contract ChainlinkExample is ChainlinkClient { | |
| // Stores the answer from the Chainlink oracle | |
| uint256 public currentPrice; | |
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
| pragma solidity 0.6.6; | |
| import "https://raw.githubusercontent.com/smartcontractkit/chainlink/7a4e19a8ff07db1be0b397465d38d175bc0bb5b5/evm-contracts/src/v0.6/VRFConsumerBase.sol"; | |
| contract VRFTestnetD20 is VRFConsumerBase { | |
| uint256[] public d20Results; | |
| bytes32 internal keyHash; | |
| uint256 internal fee; |
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
| pragma solidity ^0.6.0; | |
| import "github.com/smartcontractkit/chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
| contract GetData is ChainlinkClient { | |
| uint256 public currentPrice; | |
| address public owner; | |
| // The address of an oracle |
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
| TRADING_DAYS_IN_2019 = 252 | |
| TODAY_NUMERIC_VALUE = 0 | |
| from datetime import datetime | |
| end = datetime.strptime('2019-02-07', '%Y-%m-%d') | |
| shape = 40000 | |
| train_valid_tickers = 2392 | |
| test_valid_tickers = 800 | |
| def transform_data(test_or_train_set, valid_tickers): | |
| y_set = [] |
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 alpha_vantage.timeseries import TimeSeries | |
| from concurrent.futures import ThreadPoolExecutor | |
| import os | |
| KEY = os.path.expandvars("$ALPHAVANTAGE_API_KEY") | |
| ts = TimeSeries(key=KEY, output_format='pandas') | |
| def get_daily_adjusted_ignore_failure(ticker): | |
| try: | |
| return ts.get_daily_adjusted(symbol=ticker,outputsize='full') |
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 | |
| url = "http://ftp.nasdaqtrader.com/dynamic/SymDir/nasdaqlisted.txt" | |
| response = requests.get(url) | |
| tickers = [line.split("|")[0] for line in response.text.split("\n")][1:-2] |
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 | |
| import json | |
| ticker = 'TSLA' | |
| # Only US tickers in the developer account | |
| token = 'XXXXX' | |
| # Get a sandbox/developer token here: https://developer.tradier.com/ | |
| headers = {'Authorization': 'Bearer {}'.format(token), | |
| 'Accept': 'application/json'} |
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 | |
| import json | |
| token = 'XXXX' | |
| # Get a key from https://iexcloud.io/cloud-login#/register/ | |
| ticker = 'TSLA' | |
| url = 'https://cloud.iexapis.com/stable/stock/{}/quote?token={}'.format(ticker, token) | |
| response = requests.get(url) | |
| print(response.json()) |