Skip to content

Commit 97ddb62

Browse files
committed
Merge branch 'main' into benchmark
2 parents 78bc7f3 + c4a2df8 commit 97ddb62

24 files changed

+727
-379
lines changed

.circleci/config.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: 2.1
2+
orbs:
3+
codecov: codecov/codecov@1.0.2
4+
5+
aliases:
6+
- &restore-cache
7+
restore_cache:
8+
key: dependency-cache-{{ checksum "package.json" }}
9+
- &install-deps
10+
run:
11+
name: Install dependencies
12+
command: npm ci
13+
- &build-packages
14+
run:
15+
name: Build
16+
command: npm run build
17+
18+
jobs:
19+
build:
20+
working_directory: ~/hft-limit-order-book
21+
docker:
22+
- image: cimg/node:lts
23+
steps:
24+
- checkout
25+
- *restore-cache
26+
- *install-deps
27+
- save_cache:
28+
key: dependency-cache-{{ checksum "package.json" }}
29+
paths:
30+
- ./node_modules
31+
- *build-packages
32+
33+
test:
34+
working_directory: ~/hft-limit-order-book
35+
docker:
36+
- image: cimg/node:lts
37+
steps:
38+
- checkout
39+
- *restore-cache
40+
- *install-deps
41+
- run:
42+
name: Unit tests
43+
command: npm run test:cov
44+
- codecov/upload:
45+
file: './coverage/clover.xml'
46+
47+
workflows:
48+
version: 2
49+
build-and-test:
50+
jobs:
51+
- build
52+
- test:
53+
requires:
54+
- build

.codecov.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
coverage:
4+
precision: 2
5+
round: down
6+
range: '40...100'
7+
status:
8+
project: yes
9+
patch: yes
10+
changes: no
11+
parsers:
12+
gcov:
13+
branch_detection:
14+
conditional: yes
15+
loop: yes
16+
method: no
17+
macro: no
18+
comment:
19+
layout: 'reach,diff,flags,tree'
20+
behavior: default
21+
require_changes: no

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10

.github/workflows/codeql-analysis.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '34 10 * * 2'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: auto-merge
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
auto-merge:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: ahmadnassri/action-dependabot-auto-merge@v2
12+
with:
13+
target: minor
14+
github-token: ${{ secrets.PRIVATE_TOKEN }}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [0.0.5](https://github.com/fasenderos/hft-limit-order-book/compare/v0.0.4...v0.0.5) (2022-07-29)
6+
7+
8+
### Features
9+
10+
* add code coverage ([7dc79ea](https://github.com/fasenderos/hft-limit-order-book/commits/7dc79ea9c320c3cd8d937db4c5de1dc544aa80c3))
11+
* add code security scanner ([2362528](https://github.com/fasenderos/hft-limit-order-book/commits/236252859662158ca975a1824ec344315873623a))
12+
* add codecov config ([672671d](https://github.com/fasenderos/hft-limit-order-book/commits/672671dec8385d7c60950433b2bf08cec3fc5cd1))
13+
* add dependabot ([1e46e08](https://github.com/fasenderos/hft-limit-order-book/commits/1e46e089735442bb50bb7a695074ebf70ffef768))
14+
* add dependebot auto-merge action ([4937a06](https://github.com/fasenderos/hft-limit-order-book/commits/4937a06ceafccfccaa5746b2cbbb98a438bddd77))
15+
16+
17+
### Bug Fixes
18+
19+
* circle ci coverage upload ([1114be2](https://github.com/fasenderos/hft-limit-order-book/commits/1114be236e047645f3f9d8533ae58031852a9794))
20+
21+
### [0.0.4](https://github.com/fasenderos/hft-limit-order-book/compare/v0.0.3...v0.0.4) (2022-07-28)
22+
23+
24+
### Bug Fixes
25+
26+
* fix update order and limit order when order already exist ([a9313cf](https://github.com/fasenderos/hft-limit-order-book/commits/a9313cf65d6dc4da963fe22f3a5db615b957d2ff))
27+
28+
### [0.0.3](https://github.com/fasenderos/hft-limit-order-book/compare/v0.0.2...v0.0.3) (2022-07-28)
29+
530
### [0.0.2](https://github.com/fasenderos/hft-limit-order-book/compare/v0.0.1...v0.0.2) (2022-07-26)
631

732

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
> NOTE: Still early and not production ready.
1+
<p align="center">
2+
<a href="https://www.npmjs.com/package/hft-limit-order-book" target="_blank"><img src="https://img.shields.io/npm/v/hft-limit-order-book?color=blue" alt="NPM Version"></a>
3+
<a href="https://github.com/fasenderos/hft-limit-order-book/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/npm/l/hft-limit-order-book" alt="Package License"></a>
4+
<a href="https://www.npmjs.com/package/hft-limit-order-book" target="_blank"><img src="https://img.shields.io/npm/dm/hft-limit-order-book" alt="NPM Downloads"></a>
5+
<a href="https://circleci.com/gh/fasenderos/hft-limit-order-book" target="_blank"><img src="https://img.shields.io/circleci/build/github/fasenderos/hft-limit-order-book/main" alt="CircleCI" ></a>
6+
<a href="https://codecov.io/github/fasenderos/hft-limit-order-book" target="_blank"><img src="https://img.shields.io/codecov/c/github/fasenderos/hft-limit-order-book" alt="Codecov"></a>
7+
</p>
28

39
> Ported from [Go orderbook](https://github.com/i25959341/orderbook)
410
@@ -17,10 +23,13 @@ Improved matching engine written in Javascript
1723
## Installation
1824

1925
Install with npm:
26+
2027
```sh
2128
npm install hft-limit-order-book --save
2229
```
30+
2331
Install with yarn:
32+
2433
```sh
2534
yarn add hft-limit-order-book
2635
```
@@ -30,9 +39,9 @@ yarn add hft-limit-order-book
3039
To start using order book you need to import `OrderBook` and create new instance:
3140

3241
```js
33-
import { OrderBook } from "hft-limit-order-book";
42+
import { OrderBook } from 'hft-limit-order-book'
3443

35-
const lob = new OrderBook();
44+
const lob = new OrderBook()
3645
```
3746

3847
Then you be able to use next primary functions:
@@ -70,6 +79,7 @@ processLimitOrder(side: 'buy' | 'sell', orderID: string, size: number, price: nu
7079
```
7180

7281
For example:
82+
7383
```
7484
processLimitOrder("sell", "uinqueID", 55, 100);
7585
@@ -133,6 +143,7 @@ processMarketOrder(side: 'buy' | 'sell', size: number);
133143
```
134144

135145
For example:
146+
136147
```
137148
processMarketOrder('sell', 6);
138149
@@ -156,7 +167,7 @@ asks: 110 -> 5
156167
-------------- -> --------------
157168
bids: 90 -> 5 90 -> 5
158169
80 -> 1 80 -> 1
159-
170+
160171
done - 2 (or more orders)
161172
partial - nil
162173
quantityLeft - 4
@@ -178,12 +189,13 @@ asks: 110 -> 5
178189
-------------- -> --------------
179190
bids: 90 -> 5 90 -> 5
180191
80 -> 1 80 -> 1
181-
192+
182193
done - 2 (or more orders)
183194
partial - nil
184195
quantityLeft - 4
185196
186197
```
198+
187199
## Contributing
188200

189201
I would greatly appreciate any contributions to make this project better. Please make sure to follow the below guidelines before getting your hands dirty.
@@ -196,6 +208,4 @@ I would greatly appreciate any contributions to make this project better. Please
196208

197209
## License
198210

199-
hft-limit-order-book is [MIT licensed](LICENSE).
200-
201-
See [LICENSE](LICENSE) and [AUTHORS](AUTHORS) files
211+
Copyright [Andrea Fassina](https://github.com/fasenderos), Licensed under [MIT](LICENSE).

0 commit comments

Comments
 (0)