Skip to content

Instantly share code, notes, and snippets.

View buiminh15's full-sized avatar
😃

buiminh15

😃
View GitHub Profile
@buiminh15
buiminh15 / a.md
Last active February 23, 2021 14:44
[QuantConnect]

Data Normalization

In QuantConnect, historical data is adjusted by default. This means the historical values are changed to account for share splits and dividend payments. Historical prices can look a little bit strange if you don't understand why it was done: e.g. instead of $10.23 the price might read $1.21216.

You can control the Data Normalization Mode for each asset individually. This is done with the: security.SetDataNormalizationMode() method. The accepted values are: Raw, Adjusted, SplitAdjusted and TotalReturn.

ibm = self.AddEquity("IBM", Resolution.Minute) ibm.SetDataNormalizationMode(DataNormalizationMode.Adjusted) //Default

Accessing Securities

@buiminh15
buiminh15 / qa
Last active May 20, 2021 03:13
[POSTGRES]
psql -U postgres
https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546
https://node-postgres.com/features/connecting
https://lptech.asia/kien-thuc/cac-loai-chuan-hoa-trong-csdl-quan-he
https://www.postgresqltutorial.com/postgresql-create-table/
@buiminh15
buiminh15 / 23 - WorkingWithTextFiles
Last active November 30, 2020 01:47
[VBA_OWLWISE]
Option Explicit
' install microsoft scripting runtime in preferences
Sub CreatingANewTextFile()
Dim fso As Scripting.FileSystemObject
Dim ts As Scripting.TextStream
Dim path As String
Set fso = New Scripting.FileSystemObject
'C:\Users\MinhBB\Desktop\VBA Practice
path = Environ("UserProfile") & "\Desktop\VBA Practice"
@buiminh15
buiminh15 / a
Last active September 25, 2020 00:41
[MONGO]
pass: iz47D9SzVk5kADn9
Sub runTool()
'
' runTool Macro
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Call runHighlight
End Sub
' version 1.1 2020/08/23
@buiminh15
buiminh15 / createQuestion.js
Last active June 28, 2020 04:45
[Node mongoose]
// runValidators: true chạy validate của enum khi update
// https://stackoverflow.com/questions/15627967/why-mongoose-doesnt-validate-on-update
// upsert: true, new: true khi update nếu không có bản ghi thì sẽ tự động tạo bản ghi mới
exports.createQuestion = (req, res) => {
// const { errors, isValid } = validateQuestionInput(req.body);
// if (!isValid) {
// return res.status(400).json(errors);
// }
@buiminh15
buiminh15 / create-get-blog.ts
Last active June 4, 2020 01:37
[Angular CRUD]
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, FormBuilder, Validators } from '@angular/forms';
import { AuthService } from '../../services/auth.service';
import { BlogService } from '../../services/blog.service';
@Component({
selector: 'app-blog',
templateUrl: './blog.component.html',
styleUrls: ['./blog.component.css']
})
@buiminh15
buiminh15 / auth.js
Created June 2, 2020 09:14
[Node Controller]
'use strict'
const User = require('../models/user.model')
const jwt = require('jsonwebtoken')
const config = require('../config')
const httpStatus = require('http-status')
const uuidv1 = require('uuid/v1')
exports.register = async (req, res, next) => {
try {
@buiminh15
buiminh15 / validateToken.js
Created May 29, 2020 15:09
[Node middleware] Middleware
const jwt = require('jsonwebtoken');
const SECRET = 'superSuperSecret';
module.exports = function (req, res, next) {
const token =
req.body.token || req.query.token || req.headers['x-access-token'];
if (token) {
return jwt.verify(token, SECRET, function (err, decoded) {
@buiminh15
buiminh15 / blog01.js
Last active June 25, 2020 04:48
[Node controller] Controller
const User = require('../models/user'); // Import User Model Schema
const Blog = require('../models/blog'); // Import Blog Model Schema
const jwt = require('jsonwebtoken'); // Compact, URL-safe means of representing claims to be transferred between two parties.
const config = require('../config/database'); // Import database configuration
exports.createBlog = (req, res) => {
// Check if blog title was provided
if (!req.body.title) {
res.json({ success: false, message: 'Blog title is required.' }); // Return error message
}