trendmanagement / tmqrexo_alexveden

1 stars 1 forks source link

public website #92

Closed spickering-git closed 7 years ago

spickering-git commented 7 years ago

@alexveden We want to build a public site to view the exos, alphas and campaigns, similar to the legacy site. I was using the dashboard site as a template, using React, Django and Python to build the site. I just don't have time to work on it and we would like to get it done asap.

We wanted to post a job for building this on freelancer. Do you have any suggestions for how we should have someone set this up, like making calls to the python model code and calls for data from mongo? Should we let them start with the dashboard code that is already written and let them build from there? Should we set up a vpn login for an outside developer to work on this? Should we let this individual access the mongodb using our current passwords etc? I'm sure there are a lot more questions I am missing.

Any of your ideas are appreciated.

alexveden commented 7 years ago

Do you have any suggestions for how we should have someone set this up, like making calls to the python model code and calls for data from mongo?

Y, this will be the best way, we need python code on the backend and React on the front end. It's not necessary to use React + Django in frontend, it could be any framework that can make REST api calls. I thinks it would be hard to find a person who know Django+React. You could find a person who will be a professional in frontend dev, and I'll take care about backend.

We wanted to post a job for building this on freelancer.

Also try to search on upwork.com

Should we let them start with the dashboard code that is already written and let them build from there?

Y we could, but I think, for new developer will be more convenient to start from scratch.

Should we set up a vpn login for an outside developer to work on this?

I don't like this idea, I think it's better to grant access to public VM created specially for web site dev.

Should we let this individual access the mongodb using our current passwords etc?

No, I think it's better to write data access REST api in Python, or just create a copy of the DB for developer.

Any of your ideas are appreciated

Instead of searching full-stack developer just try to find a person good in front-end development and user interfaces. Who can focus website, but not DB calls and different back-end stuff.

Answer following questions for yourself:

  1. Do you need CMS on the site (i.e. ability to add articles, blog, news or smth else)?
  2. Do you need this site to be maintained by any person in our team (you / me) in the future ?
  3. Do you need dynamic user interface or page reloading is ok?
  4. Do you need new design or just move old site design to new DB?
spickering-git commented 7 years ago

@alexveden please review and comment:

REST calls

  1. GetAvailableCampaigns Outputs: { "campaigns":[{ "campaign":"campaign_example_1", "instrument":"instrument_example_1" }] }

  2. GetCampaignSeriesData Inputs: campaign = 'the campaign name' performance_fee_percentage = 'the performance fee in decimal form, the default will be 0' (will provide additional info on this) commission_dollars = 'the per side cost in dollars' starting_date = 'the starting date of the window (if blank return the campaign start date)' end_date = 'the ending date of the window (if blank return the campaign end date)' Outputs: { "campaign":"the campaign name" (probably a good idea to return to make sure it is correct), "starting_date":"####-##-##", "ending_date":"####-##-##", "starting_value":"####",(the start value of equity in the date window) "ending_value":"####", (the end value of equity in the date window) "total_number_of_trades":"####", "total_cost":"####", (the total commission cost of trading over the date window) "max_drawdown":"####", (the total max drawdown over the date window) "max_delta":"####", (the max delta over the date window) "average_delta":"####", (the average delta over the date window) "series": [ { "date":"####-##-##", "change":"####", "costs":"####", "trade_count":"####", "delta":"####", "equity":"####" }, { "date":"####-##-##", "change":"####", "costs":"####", "trade_count":"####", "delta":"####", "equity":"####" }, ] }

  3. GetCampaignPayoff Inputs: campaign = 'the campaign name' date = 'the date of the payoff analysis (if blank return the campaign end date)' Outputs: { "campaign":"the campaign name", "date":"the date of the analysis", "current_future_price":"####", "positions": [ { "asset":"name of asset", "open_price":"####", "current_price":"####", "qty":"####", "pnl":"####", "iv":"####", "delta":"####", "to_expiration":"# days", "rfr":"####" }, { "asset":"name of asset", "open_price":"####", "current_price":"####", "qty":"####", "pnl":"####", "iv":"####", "delta":"####", "to_expiration":"# days", "rfr":"####" } ], "payoff_series": [ { "future_price":"####", "current_profit_loss":"####", "expiration_profit_loss":"####" }, { "future_price":"####", "current_profit_loss":"####", "expiration_profit_loss":"####" }, ], "delta_series": [ { "future_price":"####", "current_delta":"####", "expiration_delta":"####" }, { "future_price":"####", "current_delta":"####", "expiration_delta":"####" }, ] }

performance_fee_percentage applies to the high water mark fee structure we will be applying to some campaigns. Default fee will be 0. We will take a fee at the end of the month if the value of the account goes above the high water mark. We will fully define this algorithm later. _For now everything returned will assume a performance_feepercentage of 0.

alexveden commented 7 years ago

Questions about GetCampaignSeriesData:

  1. Do this request implies that we need to get starting capital as input?
  2. Also costs are already included to campaign equity line. So I can recalculate campaign costs if it's required.
alexveden commented 7 years ago

@spickering-git I've finished campaign API prototype, so you could test these methods in the browser:

  1. Campaign list: http://10.0.1.2/api/campaigns/list/
  2. GetCampaignSeriesData: http://127.0.0.1:8000/api/campaigns/series/?campaign=ES_Bidirectional%20V3&starting_date=2015-01-01&end_date=2016-01-01 (inputs are the same that you've posted above, but performance_fee and costs are not used yet)
  3. Payoffs:

Notes:

  1. if backend fails it return json status = 'error', otherwise 'OK'. Example of failing method: http://10.0.1.2/api/campaigns/series/ (traceback will be removed when we move to the productions due to security reasons)
  2. Campaign names should be URL encoded, for example ' ' char symbol must be replaced by %20, etc..
  3. Almost all inputs are optional, but 'campaign' is required
  4. Payoff API requests are very heavy because I'm querying SQL (hopefully it will be much faster when we move to the Mongo)

p.s. Currently this API only accessible from development server, I could set up web playground for the new developer on your mark.

spickering-git commented 7 years ago

Questions about GetCampaignSeriesData:

  1. Do this request implies that we need to get starting capital as input? Yes, I missed that. We will need starting capital as input.

  2. Also costs are already included to campaign equity line. So I can recalculate campaign costs if it's required. Yes the costs are included, however, if the default (of $3 a side and 0% participation profit) is not requested, the equity line will need to be recalculated.

spickering-git commented 7 years ago

Please set up web playground for the new developer on the public site.

alexveden commented 7 years ago

Please set up web playground for the new developer on the public site.

I've added only http:// access to development server (10.0.2.1), other ports are closed. So the web-dev playground can be accessed via public IP 149.56.126.25. Tell me if you need to get access to dev server (10.0.2.1) via public IP (i.e port forwarding a.k.a. DMZ), to implement this is need to add authentication to the internal backend server, to prevent public access to private web-site or api calls. I will send you credentials to Slack.

spickering-git commented 7 years ago

@alexveden we need to amend the Campaign Series call or add 1 more call we need the future bars if we have it otherwise future day close for the underlying instrument of the campaign (not sure if you have a way to create the day bars on the fly) we could use the 'instrument' value from the Campaigns List

but I don't want the developer to have to worry about matching up dates etc. if we ask for a campaign on crude oil from jan 1 2016 -> jan 1 2017 and it returns 250 data points

and we call the underlying future bars api call with jan 1 2016 -> jan 1 2017 as date parameters it should return the exact same dates.

inputs: instrument start_date end_date

outputs: instrument series[ date, open, high, low, close ]

alexveden commented 7 years ago

OK, I'll will return EXO ContFut series for the product, and when new datafeed will be ready I could rewrite the code to use new framework.

if we ask for a campaign on crude oil from jan 1 2016 -> jan 1 2017 and it returns 250 data points

Should I fill the holidays and non existing data with last values?

Do you need intraday or EOD future quotes at decision time?

spickering-git commented 7 years ago

We wanted to show OHLC of each day, however, if that is going to take too long to program out right now, just fill in the close price for open, high and low.

It doesn't matter whether you include values for holidays or not. The key is that the days in the campaign series match the days in the underlying futures series.

alexveden commented 7 years ago

I decided to change campaign request and add new parameter include_price=1 (by default the price series are not included): /api/campaigns/series/?campaign=ES_Bidirectional%20V3&starting_date=2015-01-01&end_date=2016-01-01&include_price=1(example of request)

Prices of campaigns and futures are time aligned.

alexveden commented 7 years ago

Added public access to the API: http://149.56.126.25:28864/api/campaigns/list/

Note: now it working in the debug mode, when the public website will be ready I will remove part of debug messages to improve the security.

spickering-git commented 7 years ago

@alexveden Can you include the parameters in the /api/campaigns/series/

  1. performance_fee = 'the performance fee in decimal form, the default will be 0'
  2. commission = 'the per side cost in dollars'
  3. starting_capital

/api/campaigns/series/?campaign=ES_Bidirectional%20V3&starting_date=2015-01-01&end_date=2016-01-01&include_price=1&starting_capital=0&performance_fee=0&commission=3

Even though this hasn't been programmed out on the model side yet. This way we don't have make changes to the web page side after this is done.

alexveden commented 7 years ago

@spickering-git Done http://149.56.126.25:28864/api/campaigns/series/?campaign=ES_Bidirectional%20V3&starting_date=2015-01-01&end_date=2016-01-01&include_price=1&starting_capital=3333&performance_fee_percentage=1&commission_dollars=3