Whatif Swaps not being calculated correctly

As per attached screenshots swaps are not being calculated correctly.



I would expect swaps for that top trade to be calculated as 0.8 lots x 120 days x -$5 = -$480 of swaps alone, yet the difference between the Main and Whatif sims is only -$8.16   less   -$1.32 = -$6.84.


Please fix.

Attachments
Strategy 164419412.sqx
(54.97 KiB)
image-0.png
(59.99 KiB)
  • Votes +7
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

JK
#1

Insanity82007

10.01.2022 01:35

Task created

b
#2

bentra

10.01.2022 02:00
Voted for this task.
JH
#3

Jabezz

10.01.2022 02:50
Voted for this task.
JK
#4

Insanity82007

10.01.2022 02:58

Attachment SwapFixed.java added

Attachment image-0.png added

Attachment image-1.png added

SwapFixed.java
(5.60 KiB)
image-0.png
(45.21 KiB)
image-1.png
(10.72 KiB)
Here is a fixed version of the swaps whatif snippet
JK
#5

Insanity82007

10.01.2022 02:58
Voted for this task.
JK
#6

Insanity82007

10.01.2022 04:24

Attachment SwapFixed.java added

SwapFixed.java
(6.25 KiB)
Added a CRITICAL component to the snippet, which is a swap price index (usually the current price). This eliminates the issue with getting smashed on swaps for older trades on indices when using Fixed $ amount or % of account/ balance to calculate trade size.


An index that currently trades at $30k that used to trade at $3k in 2009 will have 10x the lot sizes for the same trades, but it would be ridiculous to make the swaps 10x the size they are considering today's prices.

E
#7

Emmanuel

11.01.2022 02:10
Voted for this task.
l
#8

Loonly

11.01.2022 17:33
Voted for this task.
g
#9

geektrader

22.04.2022 17:58
Voted for this task.
Bt
#10

beetrader

22.04.2022 19:12
Voted for this task.
g
#11

Lee Guan Chuan

07.09.2022 13:28

Status changed from New to Fixed


Votes: +7

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please