{"info":{"_postman_id":"c2b20fe7-a67c-49ac-a4ca-4a21742c7e84","name":"Strategies","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"5027621","collectionId":"c2b20fe7-a67c-49ac-a4ca-4a21742c7e84","publishedId":"TVzSjwkc","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-01-13T00:43:40.000Z"},"item":[{"name":"{{baseUrl}}/v1/strategies","id":"dcdf0450-abea-4390-a55d-32aa4035da55","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Strategy 1\",\n    \"buy_percentage\": 0.70,\n    \"buy_percentage_type_of\": \"buying_power\",\n    \"sell_percentage\": 1,\n    \"sell_percentage_type_of\": \"quantity\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies","description":"<h1 id=\"parameters\">Parameters</h1>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>name</td>\n<td>string</td>\n<td>false</td>\n<td></td>\n</tr>\n<tr>\n<td>buy_percentage</td>\n<td>number</td>\n<td>true</td>\n<td>0 - 1</td>\n</tr>\n<tr>\n<td>buy_percentage_type_of</td>\n<td>string</td>\n<td>true</td>\n<td><code>equity</code> or <code>buying_power</code> (of <a href=\"https://alpaca.markets/docs/api-documentation/api-v2/account/#account-entity\">Alpaca account</a>).</td>\n</tr>\n<tr>\n<td>sell_percentage</td>\n<td>number</td>\n<td>true</td>\n<td>0 - 1</td>\n</tr>\n<tr>\n<td>sell_percentage_type_of</td>\n<td>string</td>\n<td>true</td>\n<td><code>quantity</code> or <code>cost_basis</code> (of position).</td>\n</tr>\n<tr>\n<td>is_active</td>\n<td>boolean</td>\n<td>false</td>\n<td>Defaults to <code>true</code>. StockPros will initialize with active strategies, only.</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"path":["v1","strategies"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"617c636f-6fc9-4dce-a914-3d5de5842860","name":"{{baseUrl}}/v1/strategies","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Strategy 1\",\n    \"buy_percentage\": 0.70,\n    \"buy_percentage_type_of\": \"buying_power\",\n    \"sell_percentage\": 1,\n    \"sell_percentage_type_of\": \"quantity\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Strategy successfully created\",\n    \"data\": {\n        \"id\": 1,\n        \"name\": \"Strategy 1\",\n        \"buy_percentage\": 0.70,\n        \"buy_percentage_type_of\": \"buying_power\",\n        \"sell_percentage\": 1.00,\n        \"sell_percentage_type_of\": \"quantity\",\n        \"is_active\": true,\n        \"created_at\": \"2021-01-12T04:08:11.331Z\",\n        \"updated_at\": \"2021-01-12T04:08:11.331Z\",\n        \"is_deleted\": false\n    }\n}"}],"_postman_id":"dcdf0450-abea-4390-a55d-32aa4035da55"},{"name":"{{baseUrl}}/v1/strategies","id":"7d3b1646-cd47-4ca1-9530-89ff16d4eda9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseUrl}}/v1/strategies","urlObject":{"path":["v1","strategies"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"ec0f1b80-40b1-4718-b430-cd35fa981767","name":"{{baseUrl}}/v1/strategies","originalRequest":{"method":"GET","header":[],"url":"{{baseUrl}}/v1/strategies"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Strategies successfully found\",\n    \"data\": [\n        {\n            \"id\": 1,\n            \"name\": \"Strategy 1\",\n            \"buy_percentage\": 0.7,\n            \"buy_percentage_type_of\": \"buying_power\",\n            \"sell_percentage\": 1,\n            \"sell_percentage_type_of\": \"quantity\",\n            \"signals\": [\n                {\n                    \"id\": 1,\n                    \"type\": \"buy\",\n                    \"operand_1\": \"price\",\n                    \"operator\": \">=\",\n                    \"percentage_difference\": 0.2,\n                    \"operand_2\": \"sma_50_day\",\n                    \"next_signal_inclusive\": false,\n                    \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"is_deleted\": false\n                },\n                {\n                    \"id\": 2,\n                    \"type\": \"buy\",\n                    \"operand_1\": \"sma_50_day\",\n                    \"operator\": \">=\",\n                    \"percentage_difference\": 0,\n                    \"operand_2\": \"price\",\n                    \"next_signal_inclusive\": true,\n                    \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"is_deleted\": false\n                },\n                {\n                    \"id\": 3,\n                    \"type\": \"buy\",\n                    \"operand_1\": \"price\",\n                    \"operator\": \">=\",\n                    \"percentage_difference\": 0.2,\n                    \"operand_2\": \"high_52_week\",\n                    \"next_signal_inclusive\": null,\n                    \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"is_deleted\": false\n                },\n                {\n                    \"id\": 4,\n                    \"type\": \"sell\",\n                    \"operand_1\": \"avg_entry_price\",\n                    \"operator\": \">=\",\n                    \"percentage_difference\": 0.4,\n                    \"operand_2\": \"price\",\n                    \"next_signal_inclusive\": false,\n                    \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"is_deleted\": false\n                },\n                {\n                    \"id\": 5,\n                    \"type\": \"sell\",\n                    \"operand_1\": \"price\",\n                    \"operator\": \">=\",\n                    \"percentage_difference\": 0.01,\n                    \"operand_2\": \"avg_entry_price\",\n                    \"next_signal_inclusive\": null,\n                    \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                    \"is_deleted\": false\n                }\n            ],\n            \"is_active\": true\n        }\n    ]\n}"}],"_postman_id":"7d3b1646-cd47-4ca1-9530-89ff16d4eda9"},{"name":"{{baseUrl}}/v1/strategies/:id","id":"a594b372-14bf-4110-8dc7-b7d516ef229c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseUrl}}/v1/strategies/1","urlObject":{"path":["v1","strategies","1"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"def097ef-3d94-4232-affa-4ead6bd40596","name":"{{baseUrl}}/v1/strategies/:id","originalRequest":{"method":"GET","header":[],"url":"{{baseUrl}}/v1/strategies/1"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Strategy successfully found\",\n    \"data\": {\n        \"id\": 1,\n        \"name\": \"Strategy 1\",\n        \"buy_percentage\": 0.7,\n        \"buy_percentage_type_of\": \"buying_power\",\n        \"sell_percentage\": 1,\n        \"sell_percentage_type_of\": \"quantity\",\n        \"signals\": [\n            {\n                \"id\": 1,\n                \"type\": \"buy\",\n                \"operand_1\": \"price\",\n                \"operator\": \">=\",\n                \"percentage_difference\": 0.2,\n                \"operand_2\": \"sma_50_day\",\n                \"next_signal_inclusive\": false,\n                \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"is_deleted\": false\n            },\n            {\n                \"id\": 2,\n                \"type\": \"buy\",\n                \"operand_1\": \"sma_50_day\",\n                \"operator\": \">=\",\n                \"percentage_difference\": 0,\n                \"operand_2\": \"price\",\n                \"next_signal_inclusive\": true,\n                \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"is_deleted\": false\n            },\n            {\n                \"id\": 3,\n                \"type\": \"buy\",\n                \"operand_1\": \"price\",\n                \"operator\": \">=\",\n                \"percentage_difference\": 0.2,\n                \"operand_2\": \"high_52_week\",\n                \"next_signal_inclusive\": null,\n                \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"is_deleted\": false\n            },\n            {\n                \"id\": 4,\n                \"type\": \"sell\",\n                \"operand_1\": \"avg_entry_price\",\n                \"operator\": \">=\",\n                \"percentage_difference\": 0.4,\n                \"operand_2\": \"price\",\n                \"next_signal_inclusive\": false,\n                \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"is_deleted\": false\n            },\n            {\n                \"id\": 5,\n                \"type\": \"sell\",\n                \"operand_1\": \"price\",\n                \"operator\": \">=\",\n                \"percentage_difference\": 0.01,\n                \"operand_2\": \"avg_entry_price\",\n                \"next_signal_inclusive\": null,\n                \"created_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"updated_at\": \"2021-01-26T22:43:24.131351-05:00\",\n                \"is_deleted\": false\n            }\n        ],\n        \"is_active\": true\n    }\n}"}],"_postman_id":"a594b372-14bf-4110-8dc7-b7d516ef229c"},{"name":"{{baseUrl}}/v1/strategies/:id","id":"15651ed3-d310-4901-90a2-ecad1ce8d5f6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Strategy 1\",\n    \"buy_percentage\": 70,\n    \"buy_percentage_type_of\": \"buying_power\",\n    \"sell_percentage\": 100,\n    \"sell_percentage_type_of\": \"quantity\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies/1","urlObject":{"path":["v1","strategies","1"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"549b4e40-d472-408a-9cad-d65405d6c7d2","name":"{{baseUrl}}/v1/strategies/:id","originalRequest":{"method":"PATCH","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"Strategy 1\",\n    \"buy_percentage\": 0.70,\n    \"buy_percentage_type_of\": \"buying_power\",\n    \"sell_percentage\": 1,\n    \"sell_percentage_type_of\": \"quantity\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies/1"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Strategy successfully updated\",\n    \"data\": {\n        \"id\": 1,\n        \"name\": \"Strategy 1\",\n        \"buy_percentage\": 0.70,\n        \"buy_percentage_type_of\": \"buying_power\",\n        \"sell_percentage\": 1.00,\n        \"sell_percentage_type_of\": \"quantity\",\n        \"is_active\": true,\n        \"created_at\": \"2021-01-12T04:08:11.331Z\",\n        \"updated_at\": \"2021-01-12T04:08:11.331Z\",\n        \"is_deleted\": false\n    }\n}"}],"_postman_id":"15651ed3-d310-4901-90a2-ecad1ce8d5f6"},{"name":"{{baseUrl}}/v1/strategies/:id","id":"ad338e7e-a4dc-43af-badd-d5c774e3e045","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"{{baseUrl}}/v1/strategies/1","urlObject":{"path":["v1","strategies","1"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"f147dd49-80a4-4b91-9dde-29e907b2adc2","name":"{{baseUrl}}/v1/strategies/:id","originalRequest":{"method":"DELETE","header":[],"url":"{{baseUrl}}/v1/strategies/1"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Strategy successfully deleted\",\n    \"data\": {\n        \"id\": 1,\n        \"name\": \"Strategy 1\",\n        \"buy_percentage\": 0.70,\n        \"buy_percentage_type_of\": \"buying_power\",\n        \"sell_percentage\": 1.00,\n        \"sell_percentage_type_of\": \"quantity\",\n        \"is_active\": true,\n        \"created_at\": \"2021-01-12T04:08:11.331Z\",\n        \"updated_at\": \"2021-01-12T04:08:11.331Z\",\n        \"is_deleted\": true\n    }\n}"}],"_postman_id":"ad338e7e-a4dc-43af-badd-d5c774e3e045"},{"name":"{{baseUrl}}/v1/strategies/:id/backtest","id":"5cabef9b-7a57-4c4c-9563-0e94a2da6d01","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"AAPL\",\n    \"years\": 3,\n    \"start_value\": 10000\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies/1/backtest","description":"<h1 id=\"parameters\">Parameters</h1>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>symbol</td>\n<td>string</td>\n<td>true</td>\n<td></td>\n</tr>\n<tr>\n<td>years</td>\n<td>number</td>\n<td>false</td>\n<td>0 - 15. Defaults to <code>5</code>.</td>\n</tr>\n<tr>\n<td>start_value</td>\n<td>number</td>\n<td>false</td>\n<td>Defaults to <code>10000</code>.</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"path":["v1","strategies","1","backtest"],"host":["{{baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"e30757bf-8f84-4fe6-a78e-15a16486ea81","name":"{{baseUrl}}/v1/strategies/:id/backtest","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"AAPL\",\n    \"years\": 3,\n    \"start_value\": 10000\n}","options":{"raw":{"language":"json"}}},"url":"{{baseUrl}}/v1/strategies/1/backtest"},"code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Backtest successfully run for strategy\",\n    \"data\": {\n        \"trades\": [\n            {\n                \"date\": \"2018-11-20\",\n                \"quantity\": 158.19209039548022,\n                \"price\": 44.25,\n                \"value\": 7000\n            },\n            {\n                \"date\": \"2019-10-28\",\n                \"quantity\": -158.19209039548022,\n                \"price\": 62.26,\n                \"value\": -9849.039548022598,\n                \"profit\": 2849.0395480225984\n            },\n            {\n                \"date\": \"2020-03-12\",\n                \"quantity\": 144.92954694836962,\n                \"price\": 62.06,\n                \"value\": 8994.327683615818\n            },\n            {\n                \"date\": \"2020-06-10\",\n                \"quantity\": -144.92954694836962,\n                \"price\": 88.21,\n                \"value\": -12784.235336315684,\n                \"profit\": 3789.9076526998642\n            }\n        ],\n        \"startValue\": 10000,\n        \"endValue\": 16638.94720072246,\n        \"returnDollars\": 6638.947200722461,\n        \"returnPercentage\": 0.6638947200722461,\n        \"winningTrades\": 2,\n        \"losingTrades\": 0,\n        \"winRate\": 1\n    }\n}"}],"_postman_id":"5cabef9b-7a57-4c4c-9563-0e94a2da6d01"}]}