$ sqlite3 app.db
sqlite3> .databases
CREATE TABLE IF NOT EXISTS stock( ...> id INTEGER PRIMARY KEY, ...> symbol TEXT NOT NULL UNIQUE, ...> company TEXT NOT NULL ...> );
sqlite3> .tables stock
.schema
sqlite3> INSERT INTO stock (symbol, company) VALUES ('MSFT', 'Microsoft Inc.')
sqlite3> select * from stock; sqlite3> select id,symbol from stock; sqlite3> select id,symbol, company from stock WHERE symbol = 'MSFT'; sqlite3> select id,symbol, company from stock WHERE symbol LIKE 'M%'; sqlite3> select id,symbol, company from stock WHERE symbol LIKE '%Micro%'; sqlite3> select id,symbol, company from stock ORDER BY symbol desc;
sqlite3> UPDATE stock SET company = 'Apple Inc.' WHERE symbol = 'AAPL';
sqlite3> DELETE from stock WHERE symbol =
press esc. press i (for "insert") to begin editing the file. paste the cron command in the file. press esc again to exit editing mode. type :wq to save ( w - write) and exit ( q - quit) the file. The command line utility that can control this is tccutil.
To reset warnings associated with the Terminal app, you can use [tccutil reset All com.apple.Terminal]. This will reset permissions and warnings associated with Terminal back to factory defaults ... but from here you would be allowed to grant permissions to Terminal.
*/1 8-3 * * 1-5 /Users/administrator/db_Trade_app/populate_db.py >> populate.log 2>&1
ls -al //list logs
cat {example}.log}//open log tail - f {example}.log//monitor las ten logs
//** In db browser joining stock id from stock and stock price **// SELECT symbol, date, open, high, low, close FROM stock_price JOIN stock on stock.id = stock_price.stock_id WHERE symbol = 'AAPL' ORDER BY date; //(but main.py function already does this)
//** In db browser join stock price on,the stock and then join on stock.id equal stockprice.stockid and then we're going to group by stockid so that so when we apply the sql aggregate function we need to get the maximum close of each stock in our database **//
SELECT symbol, name, stock_id, max(close), date FROM stock_price join stock on stock.id = stock_price.stock_id GROUP BY stock_id ORDER BY symbol
$uvicorn main:app --reload
- fastapi can serve data to react or any other framework
- under index route print(dir(request))
https://semantic-ui.com/introduction/advanced-usage.html https://semantic-ui.com/collections/table.html
select * from stock_price where rsi_14 is not null
SELECT symbol, rsi_14, sma_20, sma_50, close FROM stock JOIN stock_price ON stock_price.stock_id = stock.id WHERE date = '2021-01-14';