How the application works ?
1. OnHold trades
will holds the trades when the trades needs to fired. Once it fires
it ensures all the trades are moved out of the OnHold trades.
2. If a trade
depends on the condition should ensure that the threshold is passed
or is more than threshold. If it more it immediately moves all the
trades. In the onhold trades.
3.Onhold trades
ensures that trades are fired when a particular price is below the
price, we should ensure that the threshold is passed.
OnHold_Trades holds the following details in its table.
COLUMN
|
TYPE | PURPOSE |
| ID | INTEGER | NEED LESS TO SAY |
| ASSET_ID | INTEGER | Assetid that trade needs to be fired. |
| RULE_ID | INTEGER | RULE ID THAT ORDERED THIS GRADUAL TRADES |
| KEYWORD | VARCHAR/STRING | TRADE THAT WOULD BE BOOKED UNDER THIS TRADE. |
| SUB_KEYWORD | VARCHAR/STRING | Subkeyword that is ordered under this category. |
| PRICE | FLOAT | Price that has reached. |
| QUANTITY | INTEGER | Quantity that should be ordered to the broker website. |
| ORDER_ID | INTEGER | After order is placed it would be updated. |
| LOCATION | INTEGER | Before order has been placed. |
| TIME | TIMESTAMP | WHEN ORDERED. |
AUDIT LOG has two
entries :
1.
THRESHOLD_PASSED_TODAY
is
Daily entry.
2.Single
entry THRESHOLD_PASSED_TODAYS_VALUE;
Should be available.
AuditLog is the
place that holds the total trade that has been fires so far, if the
trade are booked out side the minimum limit it directly updates the
trade and change the data at| Column | Value it should hold | Reason/Description |
| DETAIL | THRESHOLD_PASSED_TODAYS_VALUE | Fixed |
| OLD_Value | FLOAT | Changed by 2 functions in AuditLogService · TotalValueInThreshold- Total Traded value · UpdateThreshold this updates the trade done so far. |
| NEW_VALUE | “ “ | EMPTY |
| FOREIGN_ID | -387781 | IGNORE THIS JUST NOT TO GET EXCEPTION. |
| Column | Value it should hold | Reason/Description |
| DETAIL | THRESHOLD_PASSED_TODAY | Fixed |
| OLD_Value | “ “ | |
| NEW_VALUE | dd-MM-yyyy | When the limit has crossed, this will help us know when the last limit was crossed. |
| FOREIGN_ID | -387783 | IGNORE THIS JUST NOT TO GET EXCEPTION. |
How Matching works ?
Once the order is placed (BROKER
WEBSITE)then an entry is made on order_id in ONHOLD_TRADES.
CASE 1: NO TRADE IS EXECUTED
- ORDER_ID is removed with NULL
CASE 2: PARTIAL QUANTITY EXECUTED
- ORDER_ID is removed.
- quantity unexecuted are put in QUANTITY.
CASE 3: FULLY EXECUTED
- Remove the row completely.
Once the whole orders are matched we
then check what is remaining in the ONHOLD_TRADES and addup SUM((
quantity * price )) goes into
AUDIT_LOG –
THRESHOLD_PASSED_TODAYS_VALUE
Can i trade any thing below LIMIT ?
Yes, we can trade offline, once we
trade offline trade or non gradual trades it just updates the limit
table and trigger a check, if total is cross then it fires rest all
trades are fired that moment only.