Skip to content

Instantly share code, notes, and snippets.

@exvion
exvion / client.mjs
Created November 5, 2024 14:05
tinkoff grpc client
import { credentials, Metadata, loadPackageDefinition } from "@grpc/grpc-js";
import { loadSync } from '@grpc/proto-loader';
import { v4 as uuidv4 } from 'uuid';
const options = {
keepCase: false,
longs: String,
enums: String,
defaults: true,
oneofs: true,
@exvion
exvion / test.mjs
Last active December 21, 2023 09:11
events and interval
import { EventEmitter } from 'events';
class Client extends EventEmitter {
interval
constructor() {
super();
this.interval = setInterval(() => { console.log("emit 1"); this.emit("onOrder", "1") }, 3000);
}
@exvion
exvion / factory.js
Created July 3, 2022 19:12
Factory
class Base {
isConnected = false;
constructor(options) {
this.options = options;
}
connect() {
isConnected = true;
}
disconnect() {
isConnected = false;
@exvion
exvion / uWSserver.mjs
Created June 29, 2022 20:37
uWS server with subscribe on quotes from QuikClient
import uWS from "uWebSockets.js";
import { QuikClient } from './QuikClient.mjs'
const connection = new QuikClient({
host: "10.211.55.3",
port: 34130
});
connection.connect();
@exvion
exvion / QuikClient.mjs
Last active October 26, 2023 19:46
client on NodeJS for QuikSharp
import net from 'net';
import { EventEmitter } from 'events';
import iconv from 'iconv-lite';
import { inspect } from 'util';
export class OrderTradeFlags {
static Active = 0x1;
static Canceled = 0x2;
static IsSell = 0x4;
static IsLimit = 0x8;