0.0.20 • Published 4 years ago

market-db v0.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

market-db


Flat file market database solution for electron and other Nodejs apps.

market-db is an npm library that let you simplify database creation and operation on a json file, for storing market data.

The db is market-data aware. So, you'll be able to store stock, options and quotation data using the api provided by the library.

The json file is saved on the application folder. The user also has the option to save the database table anywhere they chose.

The table format contained in the table_name.json should be in the form of

{
  "table_name": [
    {
      "field1": "Value of field 1",
      "field2": "Value of field 2",
      ...
    }
  ]
}

Important: The script that uses this library should be run with electron command first in order to create the directory on the user data folder (when not using a custom directory for the database). The name that will be used for the app directory will be what was indicated in the package.json as name. If this is not set, the name property will be used.

Installation

The preferred way of installation is to install it locally on the application.

npm install market-db --save

Init Database

Creates multiple tables [table-name].js inside the application userData folder.

In Windows, the application folder should be in C:\Users\[username]\AppData\Roaming\[application name]

const db = require('market-db');
const { app, BrowserWindow } = require("electron");

db.initDB('customers')
    .then((result) => {
        // result handler here
    })
    .catch((error)=> {
        // error handler here
    });

/*
	Output:
    	Success: true
        Message: Success!

	Result file (customers.json):
    {
    	"symbols": [
            {
                "symbol": "TSLA",
                "name": "TSLA Inc."
            }
        ]
    }
*/

TBD: To be updated

For contributions, please see the CONTRIBUTE.md file. Thank you.

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.14

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago