npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qfin/schemas

v0.0.31

Published

The awesome database schemas for QFin

Downloads

2

Readme

The awesome database schemas for QFin 😎 ❤

📦 Features

  • Support for ES6 modules
  • Unit testing using Jest
  • All the usual goodies: ESLint, Babel, Webpack etc.
  • Auto code formatting using Prettier
  • Automated versioning
  • Automated changelog generator
  • Automated readme file and source documentation generator
  • Git Hooks integrations - git push will trigger auto build, versioning, documentation generation etc.
  • Watch for file changes in development mode
  • Local in-memory DynamoDB database support

💾 Install

Latest Release: @qfin/schemas:0.0.31

npm install @qfin/schemas

💻 Development

Most of the things are automated so as a developer you will have less things to worry or care about. Simply write code and let us take care of the rest.

Running

Development Mode

You can run the development mode of the application by simply running the following command:

npm run dev

This will trigger a development build and the build system will skip testing, generating documentations etc. thereby reducing the build time significantly.

Once the build is completed, the application will start in development mode.

NOTE: In development mode only, the system will watch for file changes. Any further changes to the source files will trigger a rebuild and will restart the application automatically and also the local database.

Production Mode

The production mode of the application can be started as follows:

npm run prod

This will trigger a production build and will do all the relevant automation of testing, generating documentations etc.

Once the build process is completed, the application will start in production mode. Changes to the filesystem will not be watched under this mode.

Testing

Tests will be automatically run when you do git push.

Test files should end with .spec.js filename and should be kept in a __tests__/ directory under respective places as a good convention.

You can always manually run the test as follows:

npm run test

Building

The project will be automatically built when you do git push.

Production build may take a couple of minutes as several steps are involved in the process such as running test coverage, generating documentations, building docker image etc.

Ideally you dont need to build the project manually unless you are testing the build system itself.

npm run build

🔗 Git

Git Commit

All git commit messages will be logged in the CHANGELOG file automatically. Hence it is advisable to commit your code often with small changes and give meaningful commit message.

Try to follow git flow branching model.

The seven rules of a great Git commit message (adapted from here):

  • Separate subject from body with a blank line
  • Limit the subject line to 50 characters
  • Capitalize the subject line
  • Do not end the subject line with a period
  • Use the imperative mood in the subject line
  • Wrap the body at 72 characters
  • Use the body to explain what and why vs. how

Git Push

Doing git push will trigger the git-hooks which will do a bunch of stuffs for you automatically:

  • Increment the patch version of the project
  • Trigger a production build
  • Running tests
  • Generating project documentations
  • Update CHANGELOG with all git commits until the point of last push
  • Update the README file
  • Update the version in docker-compose.yml file
  • Generating new versioned docker image

NOTE: If you wish to skip these automations, then you should do git push --no-verify. One usecase would be to skip incrementing the package version when merging two branches and pushing the merged code.

⚙ QFin Schemas Documentation

PurposeType

@qfin/schemas defines various object schemas and corresponding helper methods that can be used to do CRUD operations across DynamoDB databases.

Type: object

Examples

const Schemas = require('@qfin/schemas');
// OR
import Schemas from '@qfin/schemas';

const {Announcement, Instrument, Ohlc, User} = Schemas;

Model.formatDynamooseResults

This is the general format of the returned results from the model query or scan methods.

Type: object

Parameters

  • items array<Model.instance> The array containing the found model instances
  • count number The total number of items retured after filtering
  • scanned number The total number of items scanned before filtering
  • timesQueried number? The total number times the items were queried
  • lastKey object? The last key used for pagination

Model.createNew

Create a new model object Every new model instance will have a unique random id which will be autogenerated if absent from the props.

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • props object? The model object properties based on the model's schema

Returns Promise<Model.instance> A promise containing the newly created model object

Model.scanWithFilter

Scan a given model with a given set of filter object

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

Examples

const { items, lastKey} = await Schema.scanWithFilter({
   FilterExpression: filterExpression,
   ExpressionAttributeValues: attributeValues,
});

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Model.scanWithFilterExpression

Scan a given model with a given set of filter expression and value

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • filterExpression string The filter expression as par DynamoDB documentations
  • attributeValues string The filter attribute values as par DynamoDB documentations
  • props object? The optional scan properties
    • props.offset object? The last key offset
    • props.limit number The number of documents to return. Defaults to 100 (optional, default 100)
    • props.attributes Array<string>? The attributes to return from this scan

Examples

const { items, lastKey} = await Schema.scanWithFilterExpression(`${key} = :prop`, { ':prop': value });

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Model.scanWithKeyValue

Scan a given model with a given set of key-value condition. Match will look for equality.

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • key string The key to filter by
  • value any The value to search for. This will be matched exactly (full and case senstive)
  • props object? The optional scan properties
    • props.offset object? The last key offset
    • props.limit number The number of documents to return. Defaults to 100 (optional, default 100)
    • props.attributes Array<string>? The attributes to return from this scan

Examples

const { items, lastKey} = await Schema.scanWithKeyValue('xyz', 10);

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Model.scanAll

Scan a given model to find all instances in a paginated way.

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • props object? The optional scan properties
    • props.offset object? The last key offset
    • props.limit number The number of documents to return. Defaults to 100 (optional, default 100)
    • props.attributes Array<string>? The attributes to return from this scan

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Model.findByIndex

Queries a given model to search by a global index.

NOTE:

All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • query object The query object
  • index string The name of the global index to use
  • props object? The optional properties
    • props.offset object? The last key offset for paginatiopn
    • props.limit number The number of documents to return. Defaults to 100. (optional, default 100)
    • props.attributes Array<string>? The attributes to return from this scan
    • props.sort number Sort the data. Positive sorts in ascending order, negative in descending. (optional, default -1)

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Model.insance.get

Get the property value of a model instance using string dot path. https://github.com/aheckmann/mpath

NOTE:

This is an insance level method. All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • path string The dot separated property path

Returns any The value of the property

Model.insance.set

Set the property value of a model instance using string dot path. https://github.com/aheckmann/mpath The model is NOT saved at this point, you need to handle saving to database separately by calling the save method.

NOTE:

This is an insance level method. All models implements this method and can have its unique behavior. Check model specific documentation for more details (if any).

Type: function

Parameters

  • path string The dot separated property path
  • value any The value to set for the property

Returns void

CorporateAction.Schema

Schema of CorporateAction

Type: object

Parameters

  • id Number The unique id
  • timestamp Number The timestamp of the ohlc point
  • purpose Number
  • exDate Number The date at which a stock will trade "cum ex" (without entitlement). So for example in a normal cash dividend, if the exdate is 25.11.2008 then the stock will trade without the right to the cash dividendfrom the 25.11.2008 onwards. Cum (latin for with) and Ex (latin for without).
  • recordDate Number The date at which your positions will be recorded in order to calculate your entitlements. So for example; if the positions in your account on record date are 100,000 shares and a cash dividend pays EUR 0.25 per share then your entitlement will be calculated as 100,000 x EUR 0.25 = EUR 25,000.
  • bcStartDate Number Book closure is a time period during which a company will not handle adjustments to the register, or requests to transfer shares. Companies will often use the book closure date to identify the cut-off date for determining which investors of record will receive a particular dividend payment.
  • bcEndDate Number Book closure end date
  • ndStartDate Number
  • ndEndDate Number

Examples

const corporateAction = {
  "id": 123456,
  "timestamp": 1554651528383,
  "purpose": CorporateAction.PurposeType.AGM,
};

CorporateAction.PurposeType

The available exchnage values

Type: object

Parameters

  • AGM Number Annual General Meeting Announcement
  • BOND Number Bond Announcement
  • BONUS Number Bonus Announcement
  • BUYBACK Number Buy Back Announcement
  • FIRST_CALL Number First Call Announcement
  • DIVIDEND Number Dividend Announcement
  • INT_DIVIDEND Number Interim Dividend Announcement
  • DISTRIBUTION Number Distribution Announcement
  • INTEREST_PAYMENT Number Interest Payment Announcement
  • REDEMPTION Number Redemption Announcement
  • STOCK_SPLIT Number Stock Split Announcement
  • CONSOLIDATION Number A reverse stock split is a type of corporate action which consolidates the number of existing shares of stock into fewer, proportionally more valuable, shares. The process involves a company reducing the total number of its outstanding shares in the open market, and often signals a company in distress.

CorporateAction.PurposeType.fromString

Convert string value to InstrumentType value

Type: function

Parameters

  • val String The string value such as AGM, DIVIDEND etc.

Returns Number The PurposeType value {@see CorporateAction.PurposeType}

Instrument.generateId

Generate instrument id out of exchange and symbol

Type: function

Parameters

Examples

const id = Instrument.generateId({
  country: Instrument.Country.INDIA,
  exchange: Instrument.Exchange.INDIA_NSE,
  series: 'EQ',
  symbol: 'RELIANCE',
});

Returns number The generated unique id for this instrument

Instrument.createNew

Create a new instrument Every new instrument will have a unique id which will be autogenerated based on the exchnage and symbol fields

Type: function

Parameters

Examples

const instrument = await Instrument.createNew({
  // id: 3371985954, auto-generated constant id for this isntrument
  country: Instrument.Country.INDIA,
  exchange: Instrument.Exchange.INDIA_NSE,
  instrumentType: Instrument.InstrumentType.EQ,
  series: 'EQ',
  symbol: 'RELIANCE',
  name: 'Reliance Industries Limited',
  exchangeId: '2885',
  brokerId: {
    zerodha: 1012012,
    upstox: '2885',
  },
});

Returns Promise<Instrument.instance> A promise containing the newly created instrument

Instrument.getAllContracts

Get all contracts

Type: function

Parameters

  • country number The country for which all contracts are needed (optional, default Instrument.Country.INDIA)

Returns Promise<Array<Instrument.instance>> A promise containing the contracts array

Instrument.getAllContractsCopy

Get all the contracts data from AWS S3 copy

Type: function

Parameters

  • s3 object The AWS S3 instance
  • bucket string? The upload bucket. Defaults to ${process.env.NODE_ENV || 'production'}.data.quantofin.com
  • key string? The upload file key. Defaults to contracts.json

Returns Promise<Object> Contracts data

Instrument.saveAllContractsCopy

Save a copy of all the contracts as file to AWS S3

Type: function

Parameters

  • s3 object The AWS S3 instance
  • data (string | Buffer) The json data to upload
  • bucket string? The upload bucket. Defaults to ${process.env.NODE_ENV || 'production'}.data.quantofin.com
  • key string? The upload file key. Defaults to contracts.json

Returns Promise<Object> AWS S3 promise object

Instrument.deleteContracts

Delete the contract file from AWS S3

Type: function

Parameters

  • s3 object The AWS S3 instance
  • bucket string? The upload bucket. Defaults to ${process.env.NODE_ENV || 'production'}.data.quantofin.com
  • key string? The upload file key. Defaults to contracts.json

Returns Promise<Object> AWS S3 promise object

Instrument.Country

The available Countries

Type: object

Parameters

Instrument.Country.fromString

Convert string value to Country value

Type: function

Parameters

  • val String The string value such as INDIA, IND etc.

Returns Number The Country value {@see Instrument.Country}

Instrument.Exchange

The available Exchnages

Type: object

Parameters

  • INDIA_NSE Number NSE India: 101
  • INDIA_BSE Number BSE India: 102
  • INDIA_MCX Number MCX India: 103

Instrument.Exchange.fromString

Convert string value to Exchange value

Type: function

Parameters

  • val String The string value such as NSE, BSE, MCX etc.

Returns Number The Exchange value {@see Instrument.Exchange}

Instrument.InstrumentType

The available exchnage values

Type: object

Parameters

  • INDEX Number Index Type: 10
  • INDEX_FUTURE Number Index Future Type: 11
  • EQ Number Equity Type: 20
  • EQ_FUTURE Number Equity Fture Type: 21
  • OPTION_CE Number European Call Option Type: 31
  • OPTION_PE Number European Put Option Type: 32

Instrument.InstrumentType.fromString

Convert string value to InstrumentType value

Type: function

Parameters

  • val String The string value such as EQ, FUT, CE, PE etc.

Returns Number The InstrumentType value {@see Instrument.InstrumentType}

Instrument.Schema

Schema of Instrument

Type: object

Parameters

  • id number The unique instrument id for this instrument. This is autogenerated based on the exchnage and symbol fields
  • country number The country code to which this instrument belongs
  • exchange number The exchange type Instrument.Exchange
  • instrumentType number The instrument type Instrument.InstrumentType
  • symbol string The symbol for the instrument - unit across a given exchange
  • series string The series this instrument belongs to. For example: NSE has EQ, BE etc. series
  • name string The name of the instrument
  • exchangeId string The unique token provided by the Exchnage for this instrument
  • brokerId object The unique token provided by the given broker for this instrument
    • brokerId.zerodha string The unique token provided by Zerodha broker for this instrument
    • brokerId.upstox string The unique token provided by Upstox broker for this instrument
    • brokerId.bloomberg string The unique token provided by Bloomberg broker for this instrument
  • circuit object The upper and lower circuit limits for this instrument
    • circuit.upper string The upper circuit band
    • circuit.lower string The lower circuit band
  • isDeleted boolean? Whether or not the instrument is deleted from the Exchnage
  • isEnabled boolean? Whether or not the instrument is enabled in the Exchnage
  • isTradeable boolean? Whether or not the instrument is tradeable in the Exchnage. For eg. Indices are not tradeable in India, but there Future contracts are
  • isin string? The unique ISIN value for the instrument
  • faceValue number? The face value of the instrument
  • issuedCapital number? The issued capital of the instrument
  • strikePrice number? The strike price in case the instrument is an Option contract
  • tickSize number? The minimum size move allowed for this instrument
  • lotSize number? The minimum amount of quantity and its multiple allowed for trading. This is relevant to Future & Option contracts
  • expiry number? The expiry timestamp for the instrument contract
  • sector object? The sectoral information this instrument belongs to
    • sector.name string? The name of the sector
    • sector.subSector string? The type of subsector (if any)
  • yearly object? The yearly extremeties of the stock
    • yearly.high string? Yearly high
      • yearly.high.value string? The yearly high price of the stock
      • yearly.high.date string? The date when this high was achieved
    • yearly.low string? Yearly low
      • yearly.low.value string? The yearly low price of the stock
      • yearly.low.date string? The date when this low was achieved
  • openInterest object? The open interest of the instrument
    • openInterest.value string? The current open interest
    • openInterest.absoluteChange string? The absolute change in open interest from previous day
  • ohlc object? The daily ohlc data points
    • ohlc.open object? The current day's open price
    • ohlc.high object? The current day's high
    • ohlc.low object? The current day's low
    • ohlc.close object? The current day's close
    • ohlc.lastTradedPrice object? The current day's last price at which the intrument was traded
    • ohlc.previousClose object? The previous day's close
    • ohlc.volume object? The total traded volume or quantity traded
    • ohlc.trades object? The trades related information
      • ohlc.trades.netValue Number? The net value traded during the day
      • ohlc.trades.numberOfTrades Number? The total number of trades for the dayinstrument

Examples

const instrument = {
  // id: 3371985954, auto-generated constant id for this isntrument
  country: Instrument.Country.INDIA,
  exchange: Instrument.Exchange.INDIA_NSE,
  instrumentType: Instrument.InstrumentType.EQ,
  series: Instrument.Series.EQ,
  symbol: 'RELIANCE',
  name: 'Reliance Industries Limited',
  exchangeId: '2885',
  brokerId: {
    zerodha: 1012012,
    upstox: '2885',
  },
};

Ohlc.getCandles

Get all candles for a given instrument and period

Type: module.Ohlc.getCandles

Parameters

  • id number The instrument id
  • period number The period of candle Ohlc.Period (optional, default Ohlc.Period.DAILY)
  • offset object? The last key offset
  • limit number The number of documents to return. Defaults to 100 (optional, default 100)
  • sort number Sort the data. Positive sorts in ascending order, negative in descending. (optional, default -1)

Examples

const candles = await Model.getCandles(123456, {
  period: Model.Period.INTRADAY_1_MIN,
  start: Date.now() - 9000000,
  limit: 200,
  sort: 1,
});

Returns Promise<Model.formatDynamooseResults> A promise containing the model result Model.formatDynamooseResults

Ohlc.Period

The available ohlc periods

Type: module.Ohlc.Period

Parameters

  • INTRADAY_1_MIN Number Intraday 1 minute candles: 1
  • INTRADAY_5_MIN Number Intraday 5 minutes candles: 5
  • INTRADAY_10_MIN Number Intraday 10 minutes candles: 10
  • INTRADAY_15_MIN Number Intraday 15 minutes candles: 15
  • INTRADAY_30_MIN Number Intraday 30 minutes candles: 30
  • INTRADAY_60_MIN Number Intraday 60 minutes candles: 60
  • DAILY Number Daily candles: 101

Ohlc.Period.fromString

Convert string value to Period value

Type: function

Parameters

  • val String The string value such as DAILY, 1_MIN, 30_MIN etc.

Returns Number The Period value {@see Ohlc.Period}

Ohlc.Schema

Schema of Ohlc Canlde Data

Type: object

Parameters

  • id Number The unique id
  • timestamp Number The timestamp of the ohlc point
  • period Number The period of the ohlc candle Ohlc.Period
  • open Number The open value of the candle
  • high Number The high value of the candle
  • low Number The low value of the candle
  • close Number The close value of the candle
  • lastTradedPrice Number? The last traded price of the instrument
  • previousClose Number? The close value for the previous day
  • volume Number? The volume traded
  • trades object? The trades related information
    • trades.netValue Number? The net value traded during the day
    • trades.numberOfTrades Number? The total number of trades for the day
  • adjusted object? The adjusted values
    • adjusted.open Number? The adjusted open value
    • adjusted.high Number? The adjusted high value
    • adjusted.low Number? The adjusted low value
    • adjusted.close Number? The adjusted close value

Examples

const ohlc = {
  "id": 123456,
  "timestamp": 1554651528383,
  "open": 627.52,
  "high": 627.52,
  "low": 621.83,
  "close": 622.98,
};

User.createNew

Create a new user Every new user will have a unique random id and a unique referral.id and these will be autogenerated if absent from the props. NOTE: If a password field is present, it will be treated as plain text and will be auto encrypted before creating the user.

Type: function

Parameters

Examples

const userProps = {
    email: '[email protected]',
    password: 'Password@123',
    roles: [ 'user' ],
    referral: {
      id: 'ABCD',
    },
    profile: {
      firstname: 'First',
      lastname: 'Last',
      avatarUrl: 'https://avatar.auth.url',
    }
};

await User.createNew(userProps);

Returns Promise<User.instance> A promise containing the newly created user

User.findOneByEmail

Search a user by her email address. NOTE: The provided email must be an exact case-insensitive match. This can't match against partial email address.

Type: function

Parameters

  • email string The user's email address

Examples

await User.findOneByEmail('[email protected]');

Returns Promise<User.instance> A promise containing the found user

User.findOneByOAuthId

Search a user by her OAuth provider and id. NOTE: This is a scan and not a query hence will be slow and is not recommended to call often

Type: function

Parameters

  • provider string The provider - google, facebook, upstox, zerodha
  • id string The user's id as given by the provider

Examples

await User.findOneByOAuthId('google', 'G-1234');

Returns Promise<User.instance> A promise containing the found user

User.instance.hasRole

Check if the user has a given role or not NOTE: This is an instance method

Type: function

Parameters

Examples

user.hasRole(User.Roles.ADMIN);

Returns boolean Whether or not the user has the given role

User.instance.isValidPassword

Check if the given plain text password matches with the user's encrypted password NOTE: This is an instance method

Type: function

Parameters

  • password string The password to check as plain text

Examples

user.isValidPassword('abcd');

Returns boolean Whether or not the given password matches against the user's set password

User.AccountSuspensionReason

Various reasons for account suspension

Type: object

Parameters

  • LICENSE_EXPIRED string Due to license expiry
  • USER_BLOCKED string Because the user is blocked by Admin
  • IP_BLOCKED string Because the user's IP is blocked by Admin

User.Role

A map of available User Roles

Type: object

Parameters

  • SUPER_ADMIN number The super admin role
  • ADMIN number The admin role
  • PARTNER number The partner role
  • PREMIUM_USER number The premium user role
  • USER number The user role. Everyone gets this role

User.Role.fromString

Convert string value to Role value

Type: function

Parameters

  • val String The string value such as admin, user etc.

Returns Number The Role value {@see User.Role}

User.AuthSchema

AuthSchema of User Generally this schema is used for OAuth authorization and login

Type: module.User.AuthSchema

Parameters

  • id string The unique user id for this Auth
  • token string The unique access token for this Auth
  • email string? The email address for this Auth
  • profile object? The user's profile details
    • profile.firstname string? The user's first name
    • profile.lastname string? The user's last name
    • profile.phone string? The user's phone number
    • profile.avatarUrl string? The user's avatar URL

Examples

const auth = {
    id: 'ABC123',
    token: 'someuniqueauthtoken',
    email: '[email protected]',
    profile: {
        avatarUrl: 'https://avatar.auth.url',
        firstname: 'First',
        lastname: 'Last',
        phone: '+911234567890',
    }
};

User.Schema

Schema of User

Type: module.User.Schema

Parameters

  • id number The unique user id for this Auth (Auto generated if absent)
  • createdAt number The unix timestamp when the object was created (in milliseconds)
  • updatedAt number The unix timestamp when the object was updated (in milliseconds)
  • email string The user's primary email
  • roles array The list of User.Role
  • password string? The password for user login - atleast 1 lowercase, 1 uppercase, 1 number, 1 special ch. and must be 8 or more chars
  • referral object User's referral details
    • referral.id string User's referral id (Auto generated if absent)
    • referral.referredBy number? User's referree's user id
    • referral.referredUsers array? The user ids of the referred users
  • profile object? The user profile
    • profile.firstname string? The user's first name
    • profile.lastname string? The user's last name
    • profile.avatarUrl string? The user's avatar URL
    • profile.phone string? The user's phone number
  • auth object? The user's other auth objects
  • payment object? The user's payment information
    • payment.firstPaymentDate date? The user's first payment date
    • payment.paymentDate date? The user's last payment date
    • payment.expiryDate date? The user's payment expiry date
    • payment.plan string? The user's payment plan
    • payment.license string? The user's payment licence code
  • subscription object? The user's various subscription details
    • subscription.email boolean? Whether the user has enabled email notification or not
    • subscription.pushNotification boolean? Whether the user has enabled push notification or not
  • check object? Various type of boolean checks
    • check.isVerified boolean? Whether the user is verified or not
    • check.isSuspended boolean? Whether the user is suspended or not
    • check.isDeleted boolean? Whether the user is deleted or not
    • check.suspensionReason string? The reason for user's account suspension User.AccountSuspensionReason

Examples

const user = {
    id: 123,
    email: '[email protected]',
    password: 'Password@123',
    roles: [User.Role.USER],
    referral: {
      id: 'ABCD',
    },
    auth: {
      google: {#User.AuthSchema}
    },
    profile: {
      firstname: 'First',
      lastname: 'Last',
      avatarUrl: 'https://avatar.auth.url',
    }
};

Scanner.Name

The available Scanners

Type: object

Parameters

  • OPEN_EQUALS_HIGH Number : 1001
  • OPEN_EQUALS_LOW Number : 1002
  • GAINERS_AND_LOSERS Number : 1003
  • OPEN_RANGE_BREAKOUT Number : 1004
  • OVER_BOUGHT_AND_SOLD Number : 1005
  • GAP_UP_AND_DOWN Number : 1006
  • CARAMILLA_POINTS Number : 1007

Scanner.Name.fromString

Convert string value to Scanner Name value

Type: function

Parameters

  • val String The string value such as OPEN_EQUALS_HIGH, GAINERS_AND_LOSERS, OVER_BOUGHT_AND_SOLD etc.

Returns Number The Scanner Name value {@see Scanner.Name}

Scanner.Type

The available Scanner Types

Type: object

Parameters

Scanner.Type.fromString

Convert string value to Scanner Type value

Type: function

Parameters

  • val String The string value such as FEED, CANDLE etc.

Returns Number The Scanner Type value {@see Scanner.Type}

Scanner.Schema

Schema of Scanner Data

Type: Object

Parameters

Examples

const scanner = {
  "name": 1001,
  "scannerType": 1,
  "data": {
     "instruments": [3371985954]
  },
};