{"action":"created","issue":{"url":"https://api.github.com/repos/freqtrade/freqtrade/issues/1229","repository_url":"https://api.github.com/repos/freqtrade/freqtrade","labels_url":"https://api.github.com/repos/freqtrade/freqtrade/issues/1229/labels{/name}","comments_url":"https://api.github.com/repos/freqtrade/freqtrade/issues/1229/comments","events_url":"https://api.github.com/repos/freqtrade/freqtrade/issues/1229/events","html_url":"https://github.com/freqtrade/freqtrade/pull/1229","id":362688900,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MzM2ODM0","number":1229,"title":"Edge Positioning","user":{"login":"mishaker","id":939309,"node_id":"MDQ6VXNlcjkzOTMwOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/939309?v=4","gravatar_id":"","url":"https://api.github.com/users/mishaker","html_url":"https://github.com/mishaker","followers_url":"https://api.github.com/users/mishaker/followers","following_url":"https://api.github.com/users/mishaker/following{/other_user}","gists_url":"https://api.github.com/users/mishaker/gists{/gist_id}","starred_url":"https://api.github.com/users/mishaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mishaker/subscriptions","organizations_url":"https://api.github.com/users/mishaker/orgs","repos_url":"https://api.github.com/users/mishaker/repos","events_url":"https://api.github.com/users/mishaker/events{/privacy}","received_events_url":"https://api.github.com/users/mishaker/received_events","type":"User","site_admin":false},"labels":[{"id":607535495,"node_id":"MDU6TGFiZWw2MDc1MzU0OTU=","url":"https://api.github.com/repos/freqtrade/freqtrade/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":38,"created_at":"2018-09-21T16:25:24Z","updated_at":"2018-11-10T10:48:39Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/freqtrade/freqtrade/pulls/1229","html_url":"https://github.com/freqtrade/freqtrade/pull/1229","diff_url":"https://github.com/freqtrade/freqtrade/pull/1229.diff","patch_url":"https://github.com/freqtrade/freqtrade/pull/1229.patch"},"body":"## Summary\r\n\r\nCurrently FT analyzes pairs in whitelist randomly (or by order in config.json) and takes a position as soon as it finds a buy signal with a fixed stake_amount. a better approach would be: \r\n\r\n- Calculating the chance of winning for each pair and sorting whitelist accordingly.\r\n- Adjusting the position size according to risk/reward.\r\n\r\nThis PR addresses the above issues by adding a package called \"Edge\". Edge will run a process every X minutes (default 30 min) using the mainloop to go through all pairs in order to: \r\n\r\n- Calculate WinRate and Expected Risk Reward ratio for a range of stoplosses.\r\n- Finding the best WinRate/Expected Risk Reward ratio for a pair. finding the best stoploss value.\r\n- Forcing the stoploss value (calculated above) into the strategy.\r\n\r\nThe process uses the backtesting download script to fetch historical data. and cache a matrix of [pair, stoploss, win_rate, expected_risk_reward, required_risk_reward]. an example of the cached matrix: \r\n\r\n| pair | stoploss |  winrate | risk_reward_ratio | required_risk_reward   |\r\n|-----|----------|---------|------------------|---------------------- |\r\n| NEO/BTC   |  -0.04  |0.666667    |       3.071181    |          0.500000 |\r\n|STEEM/BTC  |   -0.02 | 0.500000    |       2.399500      |        1.000000 |\r\n|DASH/BTC    | -0.01 | 0.625000     |      1.181620     |         0.600000  |\r\n| BNB/BTC   |  -0.08 | 0.625000    |       1.128478      |        0.600000|\r\n| CMT/BTC  |   -0.05 | 0.583333    |       0.952720     |         0.714286|\r\n| XEM/BTC   |  -0.03 | 0.500000     |      1.194416     |         1.000000 |\r\n\r\nWinRate is the number of winning trades divided by number of trades (e.x. if 4 trades out of 10 are profitable then the winrate is 40%). \r\n\r\nRisk Reward Ratio is the ratio between your loss and your take profit. as an example lets say you take a position with an entry price of 100$. you put your stoploss at 90$ (i.e. 10%) and your take profit (sell point) is 120$. your risk reward would be 2 (your profit would be two times your loss). \r\n\r\nWhile going through historical data we are only interested in finding two and only two things: \r\n\r\n- Amount/Number of losses if the stoploss hit.\r\n- Amount/Number of profits if sell signal is triggered.\r\n\r\nTODO list before merging the PR:\r\n\r\n- [X] Fixing .travis script which breaks tests currently.\r\n- [X] Fixing already broken tests.\r\n- [X] Finding an alternative for py_find_1st, otherwise try to make its installation clean.\r\n- [X] Finding a proper way to sort the matrix according to WinRate and RRR. \r\n- [X] Make backslap function more readable\r\n- [X] Writing tests\r\n- [X] Writing documentation\r\n\r\nWill replace #1147 and #1114 "},"comment":{"url":"https://api.github.com/repos/freqtrade/freqtrade/issues/comments/437575139","html_url":"https://github.com/freqtrade/freqtrade/pull/1229#issuecomment-437575139","issue_url":"https://api.github.com/repos/freqtrade/freqtrade/issues/1229","id":437575139,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzU3NTEzOQ==","user":{"login":"doftorul","id":848034,"node_id":"MDQ6VXNlcjg0ODAzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/848034?v=4","gravatar_id":"","url":"https://api.github.com/users/doftorul","html_url":"https://github.com/doftorul","followers_url":"https://api.github.com/users/doftorul/followers","following_url":"https://api.github.com/users/doftorul/following{/other_user}","gists_url":"https://api.github.com/users/doftorul/gists{/gist_id}","starred_url":"https://api.github.com/users/doftorul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doftorul/subscriptions","organizations_url":"https://api.github.com/users/doftorul/orgs","repos_url":"https://api.github.com/users/doftorul/repos","events_url":"https://api.github.com/users/doftorul/events{/privacy}","received_events_url":"https://api.github.com/users/doftorul/received_events","type":"User","site_admin":false},"created_at":"2018-11-10T10:48:39Z","updated_at":"2018-11-10T10:48:39Z","author_association":"NONE","body":"As it is now the Edge is based on a arbitrary, static value that may or may not be valid after a trade has executed.\r\nIf your 1st trade is a losing trade, the amount you lose is not extracetd from the the initial total stake amount, the current state of Edge considers that it is still being avalaible in the wallet and therefore can lead to not being able to execute a  2nd subsequent trade due to insufficient funds.\r\nThis is one of the reasons there should be a cap on the total amount a trade can use from the wallet or a check of the existing balance in the account before trying to open a 2nd trade following a lose."}}
{"actor":{"display_login":"doftorul"}}