New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@debut/plugin-utils

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@debut/plugin-utils

Debut utilites for core and plugins

latest
Source
npmnpm
Version
2.0.3
Version published
Weekly downloads
23
53.33%
Maintainers
1
Weekly downloads
 
Created
Source

@debut/plugin-utils

A set of indispensable utilities for the Debut ecosystem.

Installation

npm install @debut/plugin-utils --save

CLI - Command Line Interface utilities

requireUncached(module: string)

Allows the specified module to be connected without the standard Node caching. Instead of a native call to require(module: string)

getBotsSchema()

Get the contents of schema.json file

getBotData(name: string, schema = getBotsSchema())

Getting the bot's meta data by the name of the constructor.

getArgs<T>()

Gets the arguments passed at startup. Returns an object key-value.

Example: node ./myscript.js --arg1=foo --arg2=bar.

import { cli } from '@debut/plugin-utils`;

const args = getArgs(); // { arg1: "foo", arg2: "bar" }

getTokens().

Getting an object with private keys to work with the broker's API. From the file .tokens.json in the working directory of the project.

.

Date - Utilities for working with dates

isSameDay(d1: Date, d2: Date)

Are the two dates the same day

isWeekend(d: string | number | Date)

Is the date the same day off

toIsoString(d: string | number | Date)

Convert date to custom ISO format to work with tinkoff API.

getWeekDay(stamp: number)

Get the day of the week in UTC time stamp

intervalToMs(interval: TimeFrame)

Converting candlestick timeframe into a value in milliseconds

Debug - Debugging utilities

logDebug(...data: any[])

Logging with event time information

File - Utilities for working with files

saveFile(path: string, data: any)

saveFile(path: string: data: any) ## Save the transferred data to the path path

ensureFile(path: string)

Checks if the path exists; if it does not, creates it

readFile(path: string)

Safely reads a file

isDir(path: string)

Is the path a directory

Math - Calculation utilities

clamp(num: number, min: number, max: number)

Clamping a number between a minimum and a maximum value

getPrecision(number: number | string)

Getting the precision of a floating point number calculation

percentChange(current: number, prev: number)

Percentage difference between two numbers

toFixed(num: number, precision = 2)

A quick fix for the accuracy of a calculation, without losing type

getRandomArbitrary(min: number, max: number, odd?: boolean)

Generation of a random number in the range [min, max] and optionally an odd number

getRandomInt(min: number, max: number, odd?: boolean)

Generation of a random integer in the range [min, max], optionally odd

Orders - Utilities for working with deals

inverseType(type: OrderType)

Inverts the type of a trade

syntheticOrderId(order: ExecutedOrder | OrderOptions)

Synthetic random identifier for a trade

getMinIncrementValue(price: number | string)

Minimum value in the accuracy of the passed number

getCurrencyProfit(order: ExecutedOrder, price: number)

Counting the current profit in the currency of the trade

getCurrencyBatchProfit(orders: ExecutedOrder[], price: number)

Counting current profit in the currency of the trade for several orders simultaneously

getCurrencyComissions(orders: ExecutedOrder[], price: number, fee: number)

Counting current commision for single order based on predicatable fee number

getCurrencyBatchComissions(orders: ExecutedOrder[], price: number, fee: number)

Counting current commision for several orders order based on predicatable fee number

Promise

sleep(ms: number)

Initializes downtime for some time in milliseconds

Keywords

Debut

FAQs

Package last updated on 17 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts