Skip to content

Instantly share code, notes, and snippets.

#LineChart {
overflow: visible /* Just in case the axis render outside of our div, let's make sure it still displays */
}
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 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'));
<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>
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
});
@LiorB-D
LiorB-D / blockchain.js
Created June 24, 2021 03:32
Blockchain Class
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
}
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(
@LiorB-D
LiorB-D / trader.py
Last active December 29, 2021 18:40
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"
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
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"