Skip to content

Instantly share code, notes, and snippets.

View charlesdarkwind's full-sized avatar

Jasmin Parent charlesdarkwind

  • Montreal, Canada
View GitHub Profile
@charlesdarkwind
charlesdarkwind / binance2.py
Created November 3, 2022 13:18
binance2.py
# Python 3.9
import asyncio
import hashlib
import aiohttp
from aiofile import async_open, AIOFile, Reader
BASE_URL = 'https://data.binance.vision'
@charlesdarkwind
charlesdarkwind / MapReduce1.java
Created November 29, 2018 19:45
JAVA Hadoop MapReduce Job. Calculates mean, standard deviation and relative stdDev for crypto prices or any financial assets.
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
@charlesdarkwind
charlesdarkwind / Exercice1.java
Created October 12, 2018 02:52
Initialisation a l'algorithmique Java
package exercice1;
import java.util.ArrayList;
import java.util.stream.IntStream;
public class Exercice1 {
public static void main(String[] args) {
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, -2, -3};
System.out.println("Somme de tout les entiers: \t\t" + getSum(arr));
@charlesdarkwind
charlesdarkwind / pseudoCode1.txt
Last active October 11, 2018 17:41
Exercice pseudoCode
6. Liste de doublons d'une liste non ordonee
Entree: monTableau: int[]
Sortie: void
Procedure: listerDoublons(monTableau)
DEBUT
POUR i = 0 a monTableau.length - 1
POUR j = 0 a monTableau.length - 1
SI ( i != j && monTableau[i] == monTableau[j] )
@charlesdarkwind
charlesdarkwind / arrayFormatter.js
Last active September 19, 2018 20:04
array formatter: log array with 10 elements per line
for (let i = 0; i < arr.length; i+=10) {
let str = '';
for (let j = i; j < i + 10; j++) if (arr[j]) str += "'"+arr[j]+"', "
console.log(str);
}
@charlesdarkwind
charlesdarkwind / cloudSettings
Last active June 3, 2019 16:24
VSCode best settings
{"lastUpload":"2019-06-03T16:24:39.179Z","extensionVersion":"v3.2.9"}
const getAvgSpread = prices => {
let totalQty = 0, totalPrices = 0;
for (let price in prices) {
const qty = prices[price];
totalQty += qty;
totalPrices += parseFloat(price) * qty;
}
const avgPrice = parseFloat((totalPrices / totalQty).toFixed(8));
return { avgPrice, totalQty };
};
@charlesdarkwind
charlesdarkwind / Ichimoku.js
Last active January 23, 2023 05:53
Ichimoku cloud Javascript node
const inputs = { tenkan: -9, kijun: -26, senkou: -52, chikou: -26 };
main['ichimoku_' + pair] = generateIchimoku(pair, false);
main['chikou_' + pair] = generateIchimoku(pair, true);
const generateIchimoku = (pair, isChikou) => {
const high = isChikou ? main.high[pair].slice(0, inputs.chikou) : main.high[pair];
const low = isChikou ? main.low[pair].slice(0, inputs.chikou) : main.low[pair];
@charlesdarkwind
charlesdarkwind / rsi.js
Last active September 24, 2018 11:38
RSI Javascript relative strenght index node nodejs
const inputs = { rsi: 8 };
main['rsi_' + pair] = generateRSI(pair);
const generateRSI = pair => {
const closes = main.closes[pair];
const len = closes.length;
const arr = [];
let prevAvgGain = 0, prevAvgLoss = 0;
class Login extends React.Component {
componentWillMount() {
base.onAuth((user) => {
if(user) {
this.props.setUser(user.displayName, user.email, user.photoURL, user.uid);
}
});
}