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
| #LineChart { | |
| overflow: visible /* Just in case the axis render outside of our div, let's make sure it still displays */ | |
| } |
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 './App.css'; | |
| import * as d3 from 'd3' | |
| import {useEffect, useState} from 'react' | |
| function App() { | |
| useEffect(() => { | |
| // Create a dataset of pets and the amount of people that own them | |
| let dataSet = [ |
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
| // This is a basic express server to serve our static html file | |
| var express = require('express'); | |
| var app = express(); | |
| var path = require('path'); | |
| app.use(express.static(__dirname + '/public')); | |
| app.get('/', function(req, res) { | |
| res.sendFile(path.join(__dirname + '/index.html')); |
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
| <html> | |
| <head> | |
| <script src="tmi.min.js">//TMI.js script</script> | |
| <script | |
| src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js" | |
| integrity="sha512-WIklPM6qPCIp6d3fSSr90j+1unQHUOoWDS4sdTiR8gxUTnyZ8S2Mr8e10sKKJ/bhJgpAa/qG068RDkg6fIlNFA==" | |
| crossorigin="anonymous" | |
| ></script> |
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
| const client = new tmi.Client({ | |
| channels: [ 'THE_NAME_OF_THE_CHANNEL' ] | |
| }); | |
| client.connect(); | |
| client.on('message', (channel, tags, message, self) => { | |
| // What we want to happen when a comment occurs | |
| }); | |
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
| class BlockChain { // Our Blockchain Object | |
| constructor() { | |
| this.blockchain = [this.startGenesisBlock()] // Initialize a new array of blocks, starting with a genesis block | |
| } | |
| startGenesisBlock() { | |
| return new Block({}) // Create an empty block to start | |
| } | |
| obtainLatestBlock() { | |
| return this.blockchain[this.blockchain.length - 1] // Get last block on the chain | |
| } |
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 alpaca_trade_api as tradeapi | |
| SEC_KEY = '' # Enter Your Secret Key Here | |
| PUB_KEY = '' # Enter Your Public Key Here | |
| BASE_URL = 'https://paper-api.alpaca.markets' # This is the base URL for paper trading | |
| api = tradeapi.REST(key_id= PUB_KEY, secret_key=SEC_KEY, base_url=BASE_URL) # For real trading, don't enter a base_url | |
| # Buy a stock | |
| api.submit_order( |
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 alpaca_trade_api as tradeapi | |
| import numpy as np | |
| import time | |
| SEC_KEY = '' | |
| PUB_KEY = '' | |
| BASE_URL = 'https://paper-api.alpaca.markets' | |
| api = tradeapi.REST(key_id= PUB_KEY, secret_key=SEC_KEY, base_url=BASE_URL) | |
| symb = "SPY" |
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 alpaca_trade_api as tradeapi | |
| import numpy as np | |
| import time | |
| SEC_KEY = '' # Enter Your Secret Key Here | |
| PUB_KEY = '' # Enter Your Public Key Here | |
| BASE_URL = 'https://paper-api.alpaca.markets' # This is the base URL for paper trading | |
| api = tradeapi.REST(key_id= PUB_KEY, secret_key=SEC_KEY, base_url=BASE_URL) # For real trading, don't enter a base_url |
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 alpaca_trade_api as tradeapi | |
| import numpy as np | |
| import time | |
| SEC_KEY = '' | |
| PUB_KEY = '' | |
| BASE_URL = 'https://paper-api.alpaca.markets' | |
| api = tradeapi.REST(key_id= PUB_KEY, secret_key=SEC_KEY, base_url=BASE_URL) | |
| symb = "SPY" |