1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "strategy": "cash_secured_put",
12 "underlyingPrice": 100,
13 "dte": 30,
14 "impliedVolatility": 30,
15 "riskFreeRate": 4,
16 "contracts": 1,
17 "label": "SPY Nov CSP",
18 "putStrike": 95,
19 "putPremium": 1.5,
20 "stockCostBasis": 100,
21 "callStrike": 105,
22 "callPremium": 1.2,
23 "priorPremiumsCollected": 0,
24 "shortStrike": 105,
25 "shortPremium": 2.5,
26 "longStrike": 110,
27 "longPremium": 1,
28 "longPutStrike": 85,
29 "longPutPremium": 0.5,
30 "shortPutStrike": 90,
31 "shortPutPremium": 1.2,
32 "shortCallStrike": 110,
33 "shortCallPremium": 1.1,
34 "longCallStrike": 115,
35 "longCallPremium": 0.4,
36 "longCallDte": 365,
37 "longCallImpliedVolatility": 28,
38 "optionType": "put",
39 "closeCost": 3,
40 "newPremium": 3.5,
41 "oldStrike": 95,
42 "newStrike": 90,
43 "originalPremium": 1.5,
44 "calculations": []
45};
46
47
48const run = await client.actor("xprm-llc/options-strategy-calculator").call(input);
49
50
51console.log('Results from dataset');
52console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
53const { items } = await client.dataset(run.defaultDatasetId).listItems();
54items.forEach((item) => {
55 console.dir(item);
56});
57
58