Giter Club home page Giter Club logo

mesosim-tracker's People

Contributors

tibkiss avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mesosim-tracker's Issues

Full Tearsheet is broken due to pandas update

Pandas just released 2.0.0, which breaks QuantStats:
QuantStats defines pandas dependency as pandas>=0.24.0
which brings in the new 2.0.0 version of Pandas.

Our html report fails with:
Error creating html report: pivot() takes 1 positional argument but 4 were given

Settlement count and NAV discrepancy during Settlement Event

The Settlement Count and the NAV during settlement events are not reported correctly.

It is important to note that this is just a representation glitch in the events file/viewer:
The number of settlements, settlement amount and NAV are all correct throughout the simulation.

Entry.ReEntrydays not always respected when Multiple Positions in Flight is active

Given a backtest where Multiple Positions in Flight is enabled and ReEntryDays is set to 1.
When two parallel positions are finishing one day after an other.
Then the entry of the first finished position is delayed further by one day as the second
position's end date will be considered during calculation of the next potential entry.

Solution is to keep track of each parallel lane/track/slot 's exit time and enable re-entering
when any track is closed past ReentryDays.

ExternalData vars not usable in StrikeSelector

Alan (N) reported:

Given a job definition with External Data, where the strikes of the contracts selected using variables
coming from the External Data. During execution the variables are not evaluated and selecting strikes
using external vars are not possible.

Add Execute step to the job definition

To greater flexibility, add an Execute step where the user allowed to enter custom lua statements.
The lua statements can define variables which will become available at Entry / Exit and Adjustment conditions
Initial design example:

"Execute": [
  { 
    "Schedule": {
      "Every": "5min"
    },
    "Statements": [
        "if underlying_price > leg_ll_strike then max_days_in_trade = 10 end"
    ] 
 },
 {
   "Schedule": {
     "Every": "post-trade"
  },
  "Statements": {
    "price_after_trade = underlying_price",
    "iv_after_trade = underlying_iv"
 }
]

Forward Test MVP

Create infrastructure to Forward Test MesoSim strategies:

  • Existing backtests and templates should be used as basis for the forward test
  • Data should be presented to the user via our web interface and another notification channel (e.g. slack)
  • Realtime (or near realtime) data should be used to provide realistic execution

RegT margin calculation

Report Reg-T margin of the structures created either via graphs and/or via events in the events.json file.

DOCS: Qty to Delta Hedging section

The Delta Hedging section lacks documentation
on how to hedge, when multiple contracts are traded.

Section should be extended, explaining the calculation.

ChangeQtyAdjustment

Brent's proposal:
Extend the adjustments with an adjustment type that changes the quantity of a previously declared leg.
Additionally, Legs at initiation could be set to 0, so they don't contribute to portfolio performance until their Qtys is changed in either direction.

Entry based on previous exit and underlying

Request from Karim:

 I want to test a campaign that isn't based on time but rather based on how many points the market has moved since the last entry. For example, enter one tranche when there is a 50 point SPX move from where the market was at during the previous entry. 

As of today there is no way to persist the underlying_price on exit and re-use in next entry.
Even if it were, campaign mode makes it difficult to distinguish between which underlying_price are we referring to.

Hence, this change is targetting our JobDefinition overhaul which will address all the shortcomings we've observed so far.

ONE Export before 2010 fails

exports generated with following example opera is not accepted by ONE.
Import fails. I believe these are from before July 2010.

SYF040320P500.0000
SYF040320P500.0000
SZP040417P1200.0000
SZP040417P1200.0000
SZP040522P1200.0000
SZP040522P1200.0000
SYG040619P650.0000
SYG040619P650.0000
SYG040717P675.0000
SYG040717P675.0000
SZP040821P1200.0000

Reported by Pramod.

Expose time of day to the user

It has been requested by Matthias and GS:
In the case of intraday trades, we should be able to exit X minutes before close.
Currently this isn't possible as the MaxDaysInTrade granularity doesn't allow the user to specify to exit before close.

One potential solution: Expose the time part (e.g. minutes_after_open and minutes_until_close) to the user
so that the EOD exit can be implemented via Exit.Conditions

Log return chart not accurate when Strategy returns are negative

Given a backtest run that yields negative returns over time.
When we represent the Log Returns graph, there will be a big spike down at the most negative NAV level.
Contrary, the Full Tearsheet Log Graph looks normal -- see the attached screenshots.

The key issue here is how we calculate the Log Return graph:
As the negative values log is undefined, we normalize the return data as the most negative number becomes 0.
QuantStats doing this differently - yet to be figured out how.

Solution: stick to QuantStat's representation in our Log Return graph.

Screenshot 2023-04-16 at 8 33 19

Screenshot 2023-04-16 at 8 33 29

AddLegsAdjustment

Add Leg Adjustment enables users to add a Leg after the position is initiated.
The flexibility of adding a leg must be similar to the flexibility present at trade initiation:

  • Expiration should be selected to either match previous legs or target new expirations (support of rolling)
  • Strikes should be selected using the StrikeSelector component
  • AbortConditions should be added so that it is possible to abort entry in unfavorable conditions (e.g. leg price too high)
  • AddLegAdjustment should be combined with a MoveLeg and/or RemoveLeg Adjustment
    "ConditionalAdjustments": {
      "pos_delta > 40": {
        "MoveLegAdjustment": null,
        "RemoveLegAdjustment": null,
        "AddLegAdjustment": {
          "LegName": "to_be_added",
          "Qty": "1",
          "Expiration": {
            "Name": "exp2",
            "DTE": "expiration_exp1_dte",
            "Min": null,
            "Max": null,
            "Roots": null
          },
          "OptionType": "Call",
          "StrikeSelector": {
            "Delta": "12"
          },
          "AbortConditions": [
             "leg_to_be_added_price > 2"
          ]
        }
      }
    },
    "MaxAdjustmentCount": null
  },

Add ML indicators

Leverage Gomb project and extend MesoSim with indicators which are optimized using ML algorithms.

[DOCS] Warn users about using far OTM options

Far OTM options are often end up with one-sided market (where bids are missing).
These scenarios are difficult to simulate and difficult to trade through (one can't exit your position due to lack of liquidity).

Our docs should provide this information to warn users about using far OTM options.

Add AbortConditions to Adjustments

Request by Teresa W:

I'd like to use the adjust single leg feature (to get my overall position back closer to delta neutral), but I want to prevent an over-adjustment beyond half of the current position delta. For example, I've noticed in manual backtesting that if I have a +10 pos_delta, sometimes the next closest available strike would create a -5 Delta, which causes an over-adjustment.

One potential solution to this request would be to add AbortConditions (similar to the one in AddLegsAdjustment) to MoveLegAdjustment.

Convert all numeric fields to Lua statements

Lua statements are more flexible than int/float fields in the Job Definition.
It can also be confusing for users that somewhere int, while at other places strings should be specified.

Change the Job Definition so that every numeric field becomes a statement:

  • Min / Max fields (Expiration & StrikeSelector)
  • Adjustment.MaxAdjustmentCount
  • Exit.MaxDaysInTrade
  • SimSettings.SlippageAmt
  • SimSettings.Commission.OptionFee

Combine runs into portfolio

Choose multiple backtests and combine them into a portfolio.
Show statistics and graphs for the joint run.

Show docs side-by-side to the JobEditor

For better user experience, we should show the Job Definition Reference right next to the job editor.
This means we'll need to move from our current docs solution and rely on api-docs style documentation.

Add Expirations to MoveLegAdjustment

To support moving/rolling legs to a new expiration the optional 'Expiration' field should be added to the MoveLegAdjustment.
It must be backward compatible, such that if no Expiration is specified ("Expiration": null) then the leg's previous expiration is used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.