open-index/open-npm huggingface dataset:
npm package: @reiryoku/ctrader-layer
Description: A Node.js communication layer for cTrader Open API
Author: Vasile Pește / Reiryoku Technologies
Latest version: 2.2.0

# cTrader Layer
[![Image](https://img.shields.io/npm/v/@reiryoku/ctrader-layer)](https://www.npmjs.com/package/@reiryoku/ctrader-layer)
[![Image](https://img.shields.io/npm/l/@reiryoku/ctrader-layer)](LICENSE)
<br>

A Node.js communication layer for cTrader [Open API](https://connect.spotware.com).<br>
This implementation is created and maintained by Reiryoku Technologies and its contributors.

## Installation
```console
npm install @reiryoku/ctrader-layer
```

## Usage
For the cTrader Open API usage refer to the [Open API Documentation](https://spotware.github.io/open-api-docs/).

### How to establish a connection
```javascript
const { CTraderConnection } = require("@reiryoku/ctrader-layer");

const connection = new CTraderConnection({
    host: "demo.ctraderapi.com",
    port: 5035,
});

await connection.open();
```

### How to send commands
You can use the `sendCommand` method to send a command with payload to the server.
The method returns a `Promise` resolved only when a response from the server is received.
If the response to the command contains an error code then the returned `Promise` is rejected.

```javascript
await connection.sendCommand("PayloadName", {
    foo: "bar",
});
```

### How to authenticate an application
```javascript
await connection.sendCommand("ProtoOAApplicationAuthReq", {
    clientId: "foo",
    clientSecret: "bar",
});
```

## How to authenticate a trading account
You can get the access token to use your account from [Open API Applications](https://connect.spotware.com/apps).
First, you have to authenticate the application, then you can authenticate your trading accounts as follows.
```javascript
await connection.sendCommand("ProtoOAAccountAuthReq", {
    accessToken: "foo",
    ctidTraderAccountId: "bar",
});
```

### How to keep connection alive
You can send a heartbeat message every 25 seconds to keep the connection alive.
```javascript
setInterval(() => connection.sendHeartbeat(), 25000);
```

### How to listen events from server
```javascript
connection.on("EventName", (event) => {
    console.log(event);
});
```

### How to get the access token profile information
Through HTTP request.
```javascript
console.log(await CTraderConnection.getAccessTokenProfile("access-token"));
```

### How to get the access token accounts
Through HTTP request.
```javascript
console.log(await CTraderConnection.getAccessTokenAccounts("access-token"));
```

## Contribution
You can create a PR or open an issue for bug reports or ideas.
npm package: @reiryoku/eslint-config-reiryoku
Description: The code style used at Reiryoku Technologies
Author: Vasile Pește / Reiryoku Technologies
Latest version: 3.0.0

# eslint-config-reiryoku
[![Image](https://img.shields.io/npm/v/@reiryoku/eslint-config-reiryoku)](https://www.npmjs.com/package/@reiryoku/eslint-config-reiryoku)
[![Image](https://img.shields.io/npm/l/@reiryoku/eslint-config-reiryoku)](LICENSE)
<br>

The code style used at Reiryoku Technologies.
npm package: @reiryoku/mida-binance
Description: A Mida plugin for using Binance
Author: Vasile Pește / Reiryoku Technologies
Latest version: 2.1.1

# Mida Binance
[![Image](https://img.shields.io/npm/v/@reiryoku/mida-binance)](https://www.npmjs.com/package/@reiryoku/mida-binance)
[![Image](https://img.shields.io/npm/l/@reiryoku/mida-binance)](LICENSE)
[![Image](https://img.shields.io/discord/780532638846287904?label=community)](https://discord.gg/cKyWTUsr3q)
<br>

A [Mida](https://github.com/Reiryoku-Technologies/Mida) plugin for using Binance.

## Supported accounts
- [x] Binance Spot
- [ ] Binance Futures
- [ ] Binance Margin
npm package: @reiryoku/mida-ctrader
Description: A Mida plugin for using cTrader
Author: Vasile Pește / Reiryoku Technologies
Latest version: 5.4.0

# Mida cTrader
[![Image](https://img.shields.io/npm/v/@reiryoku/mida-ctrader)](https://www.npmjs.com/package/@reiryoku/mida-ctrader)
[![Image](https://img.shields.io/npm/l/@reiryoku/mida-ctrader)](LICENSE)
[![Image](https://img.shields.io/discord/780532638846287904?label=community)](https://discord.gg/cKyWTUsr3q)
<br>

A [Mida](https://github.com/Reiryoku-Technologies/Mida) plugin for using cTrader.

## Usage
For the complete documentation refer to [Mida](https://github.com/Reiryoku-Technologies/Mida).

### Broker account login
How to login into a cTrader account.
```javascript
import { Mida, } from "@reiryoku/mida";
import { CTraderPlugin, } from "@reiryoku/mida-ctrader";

// Use the Mida cTrader plugin
Mida.use(new CTraderPlugin());

// Login into a cTrader account
const myAccount = await Mida.login("cTrader", {
    clientId: "",
    clientSecret: "",
    accessToken: "",
    cTraderBrokerAccountId: "",
});
```

### Timeframes
The supported timeframes<br><br>
`M1` `M2` `M3` `M4` `M5` `M10` `M15` `M30`
`H1` `H4` `H12` `D1` `W1` `MN1`
npm package: @reiryoku/mida-tulipan
Description: A Mida plugin providing technical analysis indicators
Author: Vasile Pește / Reiryoku Technologies
Latest version: 4.0.0

# Mida Tulipan
[![Image](https://img.shields.io/npm/v/@reiryoku/mida-tulipan)](https://www.npmjs.com/package/@reiryoku/mida-tulipan)
[![Image](https://img.shields.io/npm/l/@reiryoku/mida-tulipan)](LICENSE)
[![Image](https://img.shields.io/discord/780532638846287904?label=community)](https://discord.gg/cKyWTUsr3q)
<br>

A [Mida](https://github.com/Reiryoku-Technologies/Mida) plugin providing technical analysis indicators.
npm package: @reiryoku/pro-inspector
Description: [![Image](https://img.shields.io/npm/v/@reiryoku/pro-inspector)](https://www.npmjs.com/package/@reiryoku/pro-inspector) [![Image](https://img.shields.io/npm/l/@reiryoku/pro-inspector)](LICENSE) <br>
Latest version: 1.1.0

# Pro Inspector
[![Image](https://img.shields.io/npm/v/@reiryoku/pro-inspector)](https://www.npmjs.com/package/@reiryoku/pro-inspector)
[![Image](https://img.shields.io/npm/l/@reiryoku/pro-inspector)](LICENSE)
<br>

A JavaScript utility improving inspection of objects on Node.js.

## Introduction
Let's suppose that we have this declaration.
```javascript
class Person {
    constructor (firstName, lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
    
    get fullName () {
        return `${this.firstName} ${this.lastName}`;
    }
    
    drink () {
        // ...
    }
    
    async read () {
        // ...
    }
}
```

This is the log of the object with Pro Inspector vs native
<p align="center">
    <img src="images/introduction.png" alt=""/>
</p>

Now let's create an instance of this class and log it using our beloved `console.log`.
```javascript
console.log(new Person("John", "Chen"));
```
This is the log in our console.
```console
Person { firstName: 'John', lastName: 'Chen' }
```
Where is the problem? The getter is not visible and the methods are not visible. This is because
by default certain class properties are not enumerable. This would happen also with a literal
object (only for getters).

Pro Inspector solves this issues by reading the descriptors of the logged entities and presenting
them with a nice syntax highlighted format.

## Installation
```console
npm i @reiryoku/pro-inspector
```

## Usage
Pro Inspector can be activated globally for every log by using `activateGlobally()`
in the program entry point.

```javascript
import { ProInspector, } from "@reiryoku/pro-inspector";

ProInspector.activateGlobally();
```

In alternative you can use Pro Inspector only on certain objects/classes.

```javascript
import { ProInspector, } from "@reiryoku/pro-inspector";

const myObject = {
    fullName: "Jessica Chen",
    
    get age () {
        return 22;
    },
    
    async destroy () {
        // ...
    },
    
    [ProInspector.inspector] () {
        return ProInspector.inspect(this);
    }
};
```
In this way Pro Inspector will be enabled only for the object above when logged with `console`.

### Options
Few options are available since the project is new and not in a stable phase.

#### spaces
Determines the tab size, default is 4.

```javascript
import { ProInspector, } from "@reiryoku/pro-inspector";

// Set tab size to 2
ProInspector.globalOptions.spaces = 2;
```

## Todo
A list of tasks for the future.

- [x] Create a format for arrays
- [x] Show functions/methods named parameters
- [ ] Create a format for maps, weak maps and sets
- [ ] Allow using custom syntax highlight colors

Create an issue to suggest improvements and/or report a bug.
npm package: @reiryoku/time-series-archive
Description: A set of time series for various asset classes such as crypto, forex or commodities.
Author: Vasile Pește / Reiryoku Technologies
Latest version: 1.0.0

# Time Series Archive
A set of time series for various asset classes such as crypto, forex or commodities.

This project is also a Node.js module: it can be used to read and parse the time series through Node.js.
If you are interested only in the time series, or if you want to use another language (for example Python),
then just download the `series` directory.

## Structure
Time series are stored in the `series` directory, follows the archive structure.
```
series
    {symbol}
        ticks
            {year}
                {month}.csv
        periods
            {year}
                {timeframe}.csv
```

The `ticks` directory contains the symbol ticks.
The `periods` directory contains the symbol candlesticks/bars.

## Format
All ticks and periods are ordered from oldest to newest and stored in CSV files.

### Ticks
The ticks format.
```
DATE, BID, ASK
```

### Periods
The periods format.
```
DATE, OPEN, HIGH, LOW, CLOSE, VOLUME
```

## Installation
The easiest way to install the Time Series Archive is using the following command in your project directory.
```console
npm install @reiryoku/time-series-archive
```
npm package: @reis/errors
Description: A collection of common error classes
Author: Adam Reis
Latest version: 6.0.3

# @reis/errors

[![npm version](https://img.shields.io/npm/v/@reis/errors.svg)](https://www.npmjs.com/package/@reis/errors)
[![github issues](https://img.shields.io/github/issues/adamreisnz/errors.svg)](https://github.com/adamreisnz/errors/issues)


A collection of common error classes

## Installation

You can install this package using `yarn` or `npm`.

```shell
#yarn
yarn add @reis/errors

#npm
npm install @reis/errors --save
```

## Usage

```js
//Load needed error classes
import {BadRequestError, NotFoundError} from '@reis/errors'

//Use in some function
export function someMiddleware() {
  throw new BadRequestError('Bad things happened')
}
```

## Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the [errors issue tracker](https://github.com/adamreisnz/errors/issues).

## License

(MIT License)

Copyright 2016-2023, Adam Reis
npm package: @reis/joi-luxon
Description: A Joi extension to automatically convert ISO date strings to Luxon DateTime objects
Author: Adam Reis
Latest version: 3.0.0

# @reis/joi-luxon

[![npm version](https://img.shields.io/npm/v/@reis/joi-luxon.svg)](https://www.npmjs.com/package/@reis/joi-luxon)
[![github issues](https://img.shields.io/github/issues/adamreisnz/joi-luxon.svg)](https://github.com/adamreisnz/joi-luxon/issues)


A Joi extension to automatically convert ISO date strings to Luxon DateTime objects

### Features
- Validates incoming date values as ISO date strings
- Automatically converts date strings to Luxon `DateTime` objects
- Able to set timezone and use modifiers like `startOf` or `endOf`
- Able to validate against other dates or Joi references using functions like `gt`, `lt`, `gte` or `lte`

### Installation

```shell
#npm
npm install @reis/joi-luxon

#yarn
yarn add @reis/joi-luxon
```

### Usage
```js
import Joi from 'joi'
import JoiLuxon from '@reis/joi-luxon'

export default Joi.extend(JoiLuxon)
```

### Examples

Validate a start and end date, setting the date to start and end of day respectively and validating that the end date is after the start date:

```js
const schema = Joi.object({
  startDate: Joi
    .luxon()
    .setZone(timezone)
    .startOf('day'),
  endDate: Joi
    .luxon()
    .setZone(timezone)
    .endOf('day')
    .gt(Joi.ref('startDate')),
})
```

Set the value to a given minimum date if it’s less than that:

```js
const schema = Joi.object({
  date: Joi
    .luxon()
    .required()
    .min(Joi.ref('$minDate'))
})

const schema = Joi.object({
  date: Joi
    .luxon()
    .required()
    .min(new Date())
})
```

All available rules and helpers:

```js
Joi

  //Base validation and conversion to Luxon DateTime object
  .luxon()

  //Sets the timezone on the object
  .setZone(timezone)

  //Modified the DateTime instance to the start/end of the given period
  .startOf(period)
  .endOf(period)

  //Validates silently against a minimum / maximum date
  .min(date)
  .max(date)

  //Validate and throw errors if the date is less than or greater than a reference date
  .lt(date)
  .gt(date)
  .lte(date)
  .gte(date)
```

## Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the [joi-luxon issue tracker](https://github.com/adamreisnz/joi-luxon/issues).


## License

(MIT License)

Copyright 2022-2023, Adam Reis
npm package: @reis/joi-object-id
Description: A Joi extension to validation MongoDB ObjectId formats
Author: Adam Reis
Latest version: 3.0.0

# @reis/joi-object-id

[![npm version](https://img.shields.io/npm/v/@reis/joi-object-id.svg)](https://www.npmjs.com/package/@reis/joi-object-id)
[![github issues](https://img.shields.io/github/issues/adamreisnz/joi-object-id.svg)](https://github.com/adamreisnz/joi-object-id/issues)


A Joi extension to automatically convert ISO date strings to object-id objects

### Features
- Extends the existing `string` validator
- Validates incoming values as MongoDB ObjectId values
- Automatically converts values to Mongoose `ObjectId` instances

### Installation

```shell
#npm
npm install @reis/joi-object-id

#yarn
yarn add @reis/joi-object-id
```

### Usage
```js
import Joi from 'joi'
import JoiObjectId from '@reis/joi-object-id'

export default Joi.extend(JoiObjectId)
```

### Examples

```js
const schema = Joi.object({
  userId: Joi.string().objectId(),
});
```

## Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the [joi-object-id issue tracker](https://github.com/adamreisnz/joi-object-id/issues).

## License

(MIT License)

Copyright 2019-2023, Adam Reis
npm package: @reis/mongoose-only-id
Description: Mongoose helper to safely strip objects to just an ID
Author: Adam Reis
Latest version: 3.0.0

# @reis/mongoose-only-id

[![npm version](https://img.shields.io/npm/v/@reis/mongoose-only-id.svg)](https://www.npmjs.com/package/@reis/mongoose-only-id)
[![github issues](https://img.shields.io/github/issues/adamreisnz/mongoose-only-id.svg)](https://github.com/adamreisnz/mongoose-only-id/issues)

Simple Mongoose helper to safely strip objects to just an ID

## Installation

You can install this package using `yarn` or `npm`.

```shell
#yarn
yarn add @reis/mongoose-only-id

#npm
npm install @reis/mongoose-only-id --save
```

## Usage

```js
import {onlyId} from '@reis/mongoose-only-id'

//Objects are stripped to only ID
onlyId({id: '123', name: 'Name'}) //'123'
onlyId({_id: new ObjectId('123'), name: 'Name'}) //'123'

//Also works on arrays
onlyId([
  {id: '123', name: 'Item 1'},
  {_id: new ObjectId('123'), name: 'Name'},
]) //['123', '123']

//Simple values are retained
onlyId('123') //'123'
onlyId(123) //123
```

## Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the [mongoose-only-id issue tracker](https://github.com/adamreisnz/mongoose-only-id/issues).

## License

(MIT License)

Copyright 2016-2023, Adam Reis
npm package: @reis/mongoose-to-json
Description: A plugin for Mongoose to normalize JSON output
Author: Adam Reis
Latest version: 3.0.0

# @reis/mongoose-to-json

[![npm version](https://img.shields.io/npm/v/@reis/mongoose-to-json.svg)](https://www.npmjs.com/package/@reis/mongoose-to-json)
[![github issues](https://img.shields.io/github/issues/adamreisnz/mongoose-to-json.svg)](https://github.com/adamreisnz/mongoose-to-json/issues)


A plugin for Mongoose to normalize JSON output

## Installation

You can install this package using `yarn` or `npm`.

```shell
#yarn
yarn add @reis/mongoose-to-json

#npm
npm install @reis/mongoose-to-json --save
```

## Usage

Setup as a global plugin for all Mongoose schema's:

```js
import mongoose from 'mongoose'
import {toJson} from '@reis/mongoose-to-json'

//Global plugin
mongoose.plugin(toJson)
```

Or for a specific (sub) schema:

```js
import mongoose from 'mongoose'
import {toJson} from '@reis/mongoose-to-json'
const {Schema} = mongoose

//Define schema
const MySchema = new Schema(/* ... */})

//Apply plugin
MySchema.plugin(toJson)
```

This plugin will normalize JSON output for client side applications from:

```json
{
  "_id": "400e8324a71d4410b9dc3980b5f8cdea",
  "__v": 2,
  "name": "Item A"
}
```

To a cleaner:

```json
{
  "id": "400e8324a71d4410b9dc3980b5f8cdea",
  "name": "Item A"
}
```

You can also remove private paths from the JSON:

```js
import mongoose from 'mongoose'
import {toJson} from '@reis/mongoose-to-json'
const {Schema} = mongoose

const schema = new Schema({
  email: {type: String},
  password: {type: String, private: true},
})

schema.plugin(toJson)

const User = mongoose.model('users', schema)
const user = new User({email: 'test@test.com', password: 'test'})

console.log(user.toJSON())
```

This will output:

```json
{
  "id": "400e8324a71d4410b9dc3980b5f8cdea",
  "email": "test@test.com"
}
```

## Issues & feature requests

Please report any bugs, issues, suggestions and feature requests in the [mongoose-to-json issue tracker](https://github.com/adamreisnz/mongoose-to-json/issues).

## License

(MIT License)

Copyright 2016-2023, Adam Reis
npm package: @reis/seki
Description: Seki – A modern javascript based Go board renderer and player, that is simple to use, extensible, compact and intuitive.
Author: Adam Reis
Latest version: 3.0.1

# Seki – An Embeddable Go Player

### Usage instructions
See [sekiplayer.com](https://sekiplayer.com/)

### About
Seki is a powerful embeddable Go/Baduk/Weiqi player for the modern age. It's Simple, Elegant, Compact and Intuitive.

It provides functionality for reading, parsing, displaying, editing and replaying Go/Baduk/Weiqi game records.

It is a continuation of the defunct [ngGo](https://github.com/adamreisnz/ngGo) project, but has undergone a full rewrite to decouple it from Angular and update it to a modern modular code base using the latest Javascript features.

ngGo was originally based on the excellent work of Jan Prokop, who created the original javascript library [WGo.js](http://wgo.waltheri.net/). ngGo was based on WGo version 1.2.5, which was the latest version at the time of conversion.

All code has been refactored for the modern web. The code has also been improved to provide more flexibility and run more efficiently. All files have been tidied up in general, linted and extensively commented to provide for easy to read source code with a consistent formatting. Lastly, all the source code files have been organized in a logical manner and split up into sensible classes, making it easy to find all the different modules and functionality of this library.
npm package: @reisertm/nora_galaxy_plugin
Description: NORA Medical Imaging Viewer
Author: Marco Reisert and Elias Kellner @ UMC Freiburg
Latest version: 1.1.8

# NORA Galaxy Visualization Plugin

More information at [https://www.nora-imaging.com/](https://www.nora-imaging.com/).

Project Leads:
Marco Reisert and Elias Kellner @ UMC Freiburg
npm package: @reismannnr2/async-result
Description: (a)synchronous error handling classes inspired by Rust
Author: reismannnr2
Latest version: 2.1.1

# async-result

(A)synchronous Result<T, E> error handling classes inspired by Rust.

## Install

```
npm install --save @reismannnr2/async-result
```

## Example

```typescript
import { AsyncResult, ok, err } from '@reismannnr2/async-result';
const result =
  AsyncResult
    .begin()
    .andThenAsync(async () => {
      try {
        // database access
        return ok(await accessToDb())
      } catch (e) {
        return err({ type: 'database-error', ex: e })
      }
    })
    .andThenAsync(async (value) => {
      try {
        // fetching data from url
        return ok(await fetch(`http://example.com/${value}`))
      } catch (e) {
        return err({ type: 'network-error', e: e });
      }   
    })
    .map((resp) => {
      return resp.foobar;
    }).toPromise();

result.match({
  ok: (value) => { console.log(value) },
  err: (error) => {
    if (error.type === 'database-error') {
      console.error(`Database Error: ${error.e.message}`);
    }
    if (error.type === 'network-error') {
      console.error(`Network Error: ${error.e.message}`);
    }
  }
});
```

## Why this? We can use just Promise since it has error-handling functionality.

Promise does not keep error type, neither enforce us to handle error.
npm package: @reismannnr2/observable-state
Description: ## install
Author: reismannnr2
Latest version: 0.1.2

# observable-state

## install

```
npm install --save @reismannnr2/observable-state
```

## usage

```typescript
import { ObservableState } from './observable-state';

const initialState = { s: '', n: 5 }
const state$ = new ObservableState(initialState);
state$.update(prev => ({...prev, s: 'updated'}));
assert(state$.currentState.s === 'updated');
assert(state$.currentState.n === 5);

const partial$ = state$.partial$(state => state.n, (state, n) => ({...state, n}));
partial$.update(n => n * 2);
assert(state$.currentState.n === 10);
assert(partial$.currentState === 10);
assert(state$.currentState !== initialState);
```
npm package: @reismannnr2/react-observable-state-hooks
Description: ## install
Author: reismannnr2
Latest version: 0.1.4

# react-observable-state-hooks

## install

```
npm install --save @reismannnr2/react-observable-state-hooks
```

## example

```tsx
import { ObservableState } from '@reismannnr2/observable-state';
import { useChildState$, useCurrentState } from '@reismannnr2/observable-state-hooks';

const ChildComponent = (props) => {
  const text$ = props.text$;
  const [text] = useCurrentState(text$);
  return <button onClick={() => { text$.update('updated') }}>{text}</button>
}
const ParentComponent = () => {
  const state$ = useMemo(() => new ObservableState({ text: 'button', numbers: [1, 2, 3] }), [])
  return <ChildComponent text$={useChildState$(state$, 'text')} />
}
```