Skip to content

Instantly share code, notes, and snippets.

View kpooooooooooo's full-sized avatar

kpooooooooooo

View GitHub Profile
@kpooooooooooo
kpooooooooooo / syfe_parser.py
Last active March 21, 2021 05:56
Syfe parser to csv for easy import into StocksCafe
# -*- coding: utf-8 -*-
"""
Created on Sat May 16 00:14:55 2020
Updated script to handle certain bugs:
- "<0.01" issue. Value will be set to 0.00 instead.
- ValueError: could not convert string to float: '1,081.62' (due to the comma)
@author: KPO
"""
////////////////////////////////////////////////////
// Using StocksCafe API
//
// API onlt for Friends of StocksCafe and you can only make 100 API calls every day (reset at 12am SGT daily)
//
// Profile: https://stocks.cafe/user/profile
// Documentation: https://documenter.getpostman.com/view/6100314/RzfmG81Y#8b9ca17e-239c-4e56-ace8-d008da4250e1
////////////////////////////////////////////////////
stockscafe_api_user = 'your_username'
@kpooooooooooo
kpooooooooooo / kpo_alpha_vantage
Last active April 16, 2019 06:40
KPO Alpha Vantage Guide
api_key = 'PASTE_YOUR_API_KEY_HERE'
url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol='
function getAlphaVantage(symbol) {
var response = UrlFetchApp.fetch(url + symbol + "&apikey=" + api_key).getContentText();
var data = JSON.parse(response);
var timeSeries = data["Time Series (Daily)"];
var value = 0.0;
for (var dates in timeSeries) {
value = timeSeries[dates]["4. close"];