Comments (9)
@afshinkoohsari I have opened a PR (#341) that addresses the issue, can you double check for me?
from nodejs-order-book.
I truly appreciate your efforts. Thank you.
from nodejs-order-book.
Thanks for reporting. Instead of matching against other orders in the book, we have to raise an error. Because essentially, you are placing a limit buy ABOVE the current market price. LIMIT orders must be rejected if they would immediately match and trade as a taker.
from nodejs-order-book.
Thanks for reporting. Instead of matching against other orders in the book, we have to raise an error. Because essentially, you are placing a limit buy ABOVE the current market price. LIMIT orders must be rejected if they would immediately match and trade as a taker.
I am convinced that the correct approach is to trigger an error. But I have realized that I should modify the entire logic of the limit order. Essentially, a limit order should be accepted and placed in the order book only if it is not executed immediately.
from nodejs-order-book.
I'm not entirely sure, but I believe the distinction should only be in the 'isMaker' flag. If a limit order is executed immediately, it is treated as a taker, whereas if it enters the order book, it should be considered a maker. Additionally, for partial orders, the remaining portion is considered the maker.
from nodejs-order-book.
You are right. I'll take a closer look
from nodejs-order-book.
Of course.
Another point I found in the Binance documentation is how they treat any update as a new order with a new ID, and the updated order will be appended at the end of the queue, regardless of changes in price or size. I'm not aware if there's a standard method for implementing FIFO matching engines. However, adopting this approach would simplify the implementation, as each update call would create a new order with an IProcessOrder
return type.
You can edit an open order’s price and amount if the order hasn’t been fulfilled or is partially filled. Once you edit an order, the previous Order ID will be canceled and a new Order ID will be created.
When an order is modified by price or quantity, it will be deemed as a new entry. Under the FIFO algorithm, or price-time-priority algorithm, orders are prioritized according to their order price and order time. Hence, the latest orders will be placed at the back of the matching order queue.
from nodejs-order-book.
Currently, the behavior is more or less like this. The old order is deleted, and a new one is created, but with the same ID
https://github.com/fasenderos/hft-limit-order-book/blob/883c13be0fccc8f457bf99ad5bf2c18430e7f9b7/src/orderside.ts#L91-L101
from nodejs-order-book.
Of course. Another point I found in the Binance documentation is how they treat any update as a new order with a new ID, and the updated order will be appended at the end of the queue, regardless of changes in price or size. I'm not aware if there's a standard method for implementing FIFO matching engines. However, adopting this approach would simplify the implementation, as each update call would create a new order with an
IProcessOrder
return type.You can edit an open order’s price and amount if the order hasn’t been fulfilled or is partially filled. Once you edit an order, the previous Order ID will be canceled and a new Order ID will be created.
When an order is modified by price or quantity, it will be deemed as a new entry. Under the FIFO algorithm, or price-time-priority algorithm, orders are prioritized according to their order price and order time. Hence, the latest orders will be placed at the back of the matching order queue.
Before v4.0.0, only when the price
of an order was changed, the order was deleted from the orderbook and recreated. From v4.0.0 the same behaviour occurs when the size
is changed. Moreover the modify
function now return IProcessOrder
.
Compared to the Binance's behavior, the only difference is that the modified order keeps the same ID. But this can be easily changed if it turns out to be a problem.
This issue can be closed now?
from nodejs-order-book.
Related Issues (19)
- add benchmark img
- Order: traderID HOT 2
- Simple test reveal bug HOT 1
- Stop-limit, stop-market and OCO orders HOT 8
- time in force parameter: GTC, FOK, IOC HOT 2
- Taker/Maker flag for each order in response HOT 1
- buyOrderCanBeFilled/sellOrderCanBeFilled optimization HOT 1
- Discussion: canceled orders
- Question: market buy quantity HOT 4
- How to use this library with DB HOT 3
- How I create orderbook UI with your lib data HOT 1
- stop self buy sell orders match HOT 3
- How to lock user balance on market order HOT 4
- Recover order book data when application restarts HOT 10
- How to get the latest price and trades from OrderBook HOT 6
- TypeError: Cannot read properties of undefined (reading 'toString') on init OrderBook HOT 5
- v6 Conditional Orders (Help Wanted)
- v6 Conditional Orders - Stop Limit, Stop Market and OCO orders HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodejs-order-book.