Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Margin Levels - Margin taken and not returned for the Rejected order in the Washed Trade #2069

Closed
2 of 8 tasks
ponthief opened this issue Aug 5, 2020 · 0 comments · Fixed by #2239
Closed
2 of 8 tasks
Assignees
Milestone

Comments

@ponthief
Copy link
Contributor

ponthief commented Aug 5, 2020

Problem encountered

When trader places 2 orders (Buy and Sell), the second order gets Rejected. The Margin is taken for the second order but not returned to the General account.

System response

Margin account balance is expected to be as it was after the Buy order is placed.

System version:
v 0.22
Protocol: Specify the protocol

  • gRPC
  • REST
  • GraphQL

Component: Specify the components that might be related

Steps to reproduce

Place Buy Order:

"orders": [
        {
          "id": "V0000000034-0000000007",
          "type": "LIMIT",
          "status": "Active",
          "side": "Buy",
          "price": "38",
          "size": "10",
          "reference": "00f030da-150d-4815-baa8-c05492e6dbb6",
          "createdAt": "2020-08-05T12:41:58.081716338Z",
          "expiresAt": null,
          "timeInForce": "GTC",
          "remaining": "10",
          "rejectionReason": null,
          "market": {
            "id": "VHSRA2G5MDFKREFJ5TOAGHZBBDGCYS67"
          },
          "trades": null
        },

Check Margin levels:

maintenanceMargin: 52629
searchLevel: 57891
initialMargin: 63154
collateralReleaseLevel: 73680
partyID: "ab193c1e4c655d07c4f9cce6a839a97349572b32f8894b505b9fd5bb2cd1670b"
marketID: "VHSRA2G5MDFKREFJ5TOAGHZBBDGCYS67"
asset: "VUSD"
timestamp: 1596631318081716338

Same trader places Sell order. Order is Rejected:

        {
          "id": "V0000000035-0000000008",
          "type": "LIMIT",
          "status": "Rejected",
          "side": "Sell",
          "price": "38",
          "size": "10",
          "reference": "0195201e-e39d-49ff-83c5-b86b864853ad",
          "createdAt": "2020-08-05T12:41:59.372225437Z",
          "expiresAt": "2020-08-05T12:43:58.081716338Z",
          "timeInForce": "GTT",
          "remaining": "10",
          "rejectionReason": "SelfTrading",
          "market": {
            "id": "VHSRA2G5MDFKREFJ5TOAGHZBBDGCYS67"
          },
          "trades": null
        },

Place Sell order (same trader):

id: "V0000000037-0000000009"
marketID: "VHSRA2G5MDFKREFJ5TOAGHZBBDGCYS67"
partyID: "ab193c1e4c655d07c4f9cce6a839a97349572b32f8894b505b9fd5bb2cd1670b"
side: SIDE_SELL
price: 10000000000
size: 1
remaining: 1
timeInForce: TIF_GTC
type: TYPE_LIMIT
createdAt: 1596631322046495752
status: STATUS_ACTIVE
reference: "7ed2c04b-cf59-4585-8fb2-4e5ad9b223be"
version: 1

Cancel Sell order:

{
          "id": "V0000000037-0000000009",
          "type": "LIMIT",
          "status": "Cancelled",
          "side": "Sell",
          "price": "10000000000",
          "size": "1",
          "reference": "7ed2c04b-cf59-4585-8fb2-4e5ad9b223be",
          "createdAt": "2020-08-05T12:42:02.046495752Z",
          "expiresAt": null,
          "timeInForce": "GTC",
          "remaining": "1",
          "rejectionReason": null,
          "market": {
            "id": "VHSRA2G5MDFKREFJ5TOAGHZBBDGCYS67"
          },
          "trades": null
        }

Check Margin Levels:

"margins": [
        {
          "initialLevel": "72996",
          "maintenanceLevel": "60830",
          "collateralReleaseLevel": "85162",
          "searchLevel": "66913"
        }
      ],

Automation

will add once pushed to system-tests/master:
search for test that has this issue id at the top

Add the necessary file(s) needed to reproduce the problem

Not reproducible

Explain why the problem/bug is not reproducible

Expected behaviour

A clear and concise description of what you expected to happen.

Logs

If applicable, add logs and/or screenshots to help explain your problem.

Additional content

Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants