A set of indispensable utilities for the Debut ecosystem.
npm install @debut/plugin-utils --save
Allows the specified module to be connected without the standard Node caching. Instead of a native call to require(module: string)
Get the contents of schema.json
file
Getting the bot's meta data by the name of the constructor.
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" }
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.
.
Are the two dates the same day
Is the date the same day off
Convert date to custom ISO format to work with tinkoff API.
Get the day of the week in UTC time stamp
Converting candlestick timeframe into a value in milliseconds
Logging with event time information
Checks if the path exists; if it does not, creates it
Safely reads a file
Is the path a directory
Clamping a number between a minimum and a maximum value
Getting the precision of a floating point number calculation
Percentage difference between two numbers
A quick fix for the accuracy of a calculation, without losing type
Generation of a random number in the range [min, max] and optionally an odd number
Generation of a random integer in the range [min, max], optionally odd
Inverts the type of a trade
Synthetic random identifier for a trade
Minimum value in the accuracy of the passed number
Counting the current profit in the currency of the trade
Counting current profit in the currency of the trade for several orders simultaneously
Counting current commision for single order based on predicatable fee number
Counting current commision for several orders order based on predicatable fee number
Initializes downtime for some time in milliseconds