{"name": "sell wang.ipynb", "path": "sell wang.ipynb", "last_modified": "2024-10-30T16:57:33.461277Z", "created": "2024-02-16T17:32:18.900756Z", "content": {"cells": [{"cell_type": "code", "execution_count": null, "id": "07c4a154", "metadata": {"trusted": true}, "outputs": [{"name": "stdout", "output_type": "stream", "text": "Market is open.\nFound Additional pages.\nLoading page 2 ...\nLoading page 3 ...\nLoading page 4 ...\nLoading page 5 ...\nLoading page 6 ...\nLoading page 7 ...\nLoading page 8 ...\nLoading page 9 ...\nLoading page 10 ...\nLoading page 11 ...\nLoading page 12 ...\nLoading page 13 ...\nLoading page 14 ...\nLoading page 15 ...\nLoading page 16 ...\nLoading page 17 ...\nLoading page 18 ...\nLoading page 19 ...\nLoading page 20 ...\nLoading page 21 ...\nLoading page 22 ...\nLoading page 23 ...\nLoading page 24 ...\nLoading page 25 ...\nLoading page 26 ...\nLoading page 27 ...\nLoading page 28 ...\nLoading page 29 ...\nLoading page 30 ...\nLoading page 31 ...\nLoading page 32 ...\nLoading page 33 ...\nLoading page 34 ...\nLoading page 35 ...\nLoading page 36 ...\nLoading page 37 ...\nLoading page 38 ...\nLoading page 39 ...\nLoading page 40 ...\nLoading page 41 ...\nLoading page 42 ...\nLoading page 43 ...\nLoading page 44 ...\nLoading page 45 ...\nLoading page 46 ...\nLoading page 47 ...\nLoading page 48 ...\nLoading page 49 ...\nLoading page 50 ...\nLoading page 51 ...\nLoading page 52 ...\nLoading page 53 ...\nLoading page 54 ...\nLoading page 55 ...\nLoading page 56 ...\nLoading page 57 ...\nLoading page 58 ...\nLoading page 59 ...\nLoading page 60 ...\nLoading page 61 ...\nLoading page 62 ...\nLoading page 63 ...\nLoading page 64 ...\nLoading page 65 ...\nLoading page 66 ...\nLoading page 67 ...\nLoading page 68 ...\nLoading page 69 ...\nLoading page 70 ...\nLoading page 71 ...\nLoading page 72 ...\nLoading page 73 ...\nLoading page 74 ...\nLoading page 75 ...\nLoading page 76 ...\nLoading page 77 ...\nLoading page 78 ...\nLoading page 79 ...\nLoading page 80 ...\nLoading page 81 ...\nLoading page 82 ...\nLoading page 83 ...\nLoading page 84 ...\nLoading page 85 ...\nLoading page 86 ...\nLoading page 87 ...\nLoading page 88 ...\nLoading page 89 ...\nLoading page 90 ...\nLoading page 91 ...\nLoading page 92 ...\nLoading page 93 ...\nLoading page 94 ...\nLoading page 95 ...\nLoading page 96 ...\nLoading page 97 ...\nLoading page 98 ...\nLoading page 99 ...\nLoading page 100 ...\nLoading page 101 ...\nLoading page 102 ...\nLoading page 103 ...\nLoading page 104 ...\nLoading page 105 ...\nStarting the loop to process each stock for trailing stop...\n\nStock: AAPL\nCurrent Price: $232.73\nStop Price from get_stop(): $226.32\nTrailing Percentage (from difference): 2.75%\nSymbol: AAPL, Quantity: 1.72, Stop Price: 226.32, Limit Price: 225.82\nFirst target price not yet reached for AAPL, setting stop loss order.\nCurrent Price: $232.73, Target Price 1: $241.74\n\nStock: TSLA\nCurrent Price: $267.79\nStop Price from get_stop(): $254.26\nTrailing Percentage (from difference): 5.05%\nSymbol: TSLA, Quantity: 2.47, Stop Price: 254.26, Limit Price: 253.76\nFirst target price not yet reached for TSLA, setting stop loss order.\nCurrent Price: $267.79, Target Price 1: $282.80\n\nStock: C\nCurrent Price: $62.12\nStop Price from get_stop(): $61.54\nTrailing Percentage (from difference): 0.93%\nSymbol: C, Quantity: 6.36, Stop Price: 61.54, Limit Price: 61.04\nFirst target price not yet reached for C, setting stop loss order.\nCurrent Price: $62.12, Target Price 1: $65.53\n\nStock: XOM\nCurrent Price: $119.67\nStop Price from get_stop(): $117.76\nTrailing Percentage (from difference): 1.60%\nSymbol: XOM, Quantity: 3.37, Stop Price: 117.76, Limit Price: 117.26\nFirst target price not yet reached for XOM, setting stop loss order.\nCurrent Price: $119.67, Target Price 1: $123.61\n\nStock: ESTC\nCurrent Price: $79.74\nStop Price from get_stop(): $77.02\nTrailing Percentage (from difference): 3.41%\nSymbol: ESTC, Quantity: 6.07, Stop Price: 77.02, Limit Price: 76.52\nFirst target price not yet reached for ESTC, setting stop loss order.\nCurrent Price: $79.74, Target Price 1: $86.61\n\nStock: GILD\nCurrent Price: $89.28\nStop Price from get_stop(): $86.14\nTrailing Percentage (from difference): 3.52%\nSymbol: GILD, Quantity: 7.41, Stop Price: 86.14, Limit Price: 85.64\nFirst target price not yet reached for GILD, setting stop loss order.\nCurrent Price: $89.28, Target Price 1: $94.33\n\nStock: AGCO\nCurrent Price: $101.01\nStop Price from get_stop(): $96.72\nTrailing Percentage (from difference): 4.25%\nSymbol: AGCO, Quantity: 6.52, Stop Price: 96.72, Limit Price: 96.22\nFirst target price not yet reached for AGCO, setting stop loss order.\nCurrent Price: $101.01, Target Price 1: $107.14\n\nStock: EOG\nCurrent Price: $123.4\nStop Price from get_stop(): $121.73\nTrailing Percentage (from difference): 1.35%\nSymbol: EOG, Quantity: 0.11, Stop Price: 121.73, Limit Price: 121.23\nSkipping order for EOG because quantity to sell is less than 1.\nFirst target price not yet reached for EOG, setting stop loss order.\nCurrent Price: $123.40, Target Price 1: $134.12\n\nStock: FANG\nCurrent Price: $183.96\nStop Price from get_stop(): $177.14\nTrailing Percentage (from difference): 3.71%\nSymbol: FANG, Quantity: 0.16, Stop Price: 177.14, Limit Price: 176.64\nSkipping order for FANG because quantity to sell is less than 1.\nFirst target price not yet reached for FANG, setting stop loss order.\nCurrent Price: $183.96, Target Price 1: $192.68\n\nStock: IART\nCurrent Price: $19.04\nStop Price from get_stop(): $18.26\nTrailing Percentage (from difference): 4.10%\nSymbol: IART, Quantity: 26.33, Stop Price: 18.26, Limit Price: 17.76\nFirst target price not yet reached for IART, setting stop loss order.\nCurrent Price: $19.04, Target Price 1: $20.00\n\nStock: DLTR\nCurrent Price: $66.955\nStop Price from get_stop(): $65.1\nTrailing Percentage (from difference): 2.77%\nSymbol: DLTR, Quantity: 9.85, Stop Price: 65.1, Limit Price: 64.6\nFirst target price not yet reached for DLTR, setting stop loss order.\nCurrent Price: $66.95, Target Price 1: $70.93\n\nStock: A\nCurrent Price: $130.19\nStop Price from get_stop(): $127.63\nTrailing Percentage (from difference): 1.97%\nSymbol: A, Quantity: 0.77, Stop Price: 127.63, Limit Price: 127.13\nSkipping order for A because quantity to sell is less than 1.\nFirst target price not yet reached for A, setting stop loss order.\nCurrent Price: $130.19, Target Price 1: $150.50\n\nStock: AME\nCurrent Price: $166.79\nStop Price from get_stop(): $163.28\nTrailing Percentage (from difference): 2.10%\nSymbol: AME, Quantity: 2.3, Stop Price: 163.28, Limit Price: 162.78\nFirst target price not yet reached for AME, setting stop loss order.\nCurrent Price: $166.79, Target Price 1: $180.99\n\nStock: LANC\nCurrent Price: $178.11\nStop Price from get_stop(): $172.6\nTrailing Percentage (from difference): 3.09%\nSymbol: LANC, Quantity: 0.78, Stop Price: 172.6, Limit Price: 172.1\nSkipping order for LANC because quantity to sell is less than 1.\nFirst target price not yet reached for LANC, setting stop loss order.\nCurrent Price: $178.11, Target Price 1: $193.72\n\nStock: NDAQ\nCurrent Price: $74.25\nStop Price from get_stop(): $74.37\nTrailing Percentage (from difference): -0.16%\nFirst target price reached for NDAQ, Current Price: $74.25, with a gain of 8.01%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: TXN\nCurrent Price: $209.175\nStop Price from get_stop(): $204.76\nTrailing Percentage (from difference): 2.11%\nSymbol: TXN, Quantity: 3.17, Stop Price: 204.76, Limit Price: 204.26\nFirst target price not yet reached for TXN, setting stop loss order.\nCurrent Price: $209.18, Target Price 1: $220.68\n\nStock: SYNA\nCurrent Price: $73.3\nStop Price from get_stop(): $69.94\nTrailing Percentage (from difference): 4.58%\nSymbol: SYNA, Quantity: 8.94, Stop Price: 69.94, Limit Price: 69.44\nFirst target price not yet reached for SYNA, setting stop loss order.\nCurrent Price: $73.30, Target Price 1: $78.11\n\nStock: MS\nCurrent Price: $117.09\nStop Price from get_stop(): $116.72\nTrailing Percentage (from difference): 0.32%\nFirst target price reached for MS, setting stop loss order for half at $117.02.\nCurrent Price: $117.09, Target Price 1: $106.71\n\nStock: ULTA\nCurrent Price: $374.73\nStop Price from get_stop(): $359.47\nTrailing Percentage (from difference): 4.07%\nSymbol: ULTA, Quantity: 2.49, Stop Price: 359.47, Limit Price: 358.97\nFirst target price not yet reached for ULTA, setting stop loss order.\nCurrent Price: $374.73, Target Price 1: $396.53\n\nStock: JBHT\nCurrent Price: $175.885\nStop Price from get_stop(): $169.94\nTrailing Percentage (from difference): 3.38%\nSymbol: JBHT, Quantity: 0.25, Stop Price: 169.94, Limit Price: 169.44\nSkipping order for JBHT because quantity to sell is less than 1.\nFirst target price not yet reached for JBHT, setting stop loss order.\nCurrent Price: $175.88, Target Price 1: $185.35\n\nStock: SLAB\nCurrent Price: $115.545\nStop Price from get_stop(): $111.91\nTrailing Percentage (from difference): 3.15%\nSymbol: SLAB, Quantity: 5.7, Stop Price: 111.91, Limit Price: 111.41\n"}, {"name": "stdout", "output_type": "stream", "text": "First target price not yet reached for SLAB, setting stop loss order.\nCurrent Price: $115.55, Target Price 1: $122.57\n\nStock: ON\nCurrent Price: $72.03\nStop Price from get_stop(): $69.5\nTrailing Percentage (from difference): 3.51%\nSymbol: ON, Quantity: 9.21, Stop Price: 69.5, Limit Price: 69.0\nFirst target price not yet reached for ON, setting stop loss order.\nCurrent Price: $72.03, Target Price 1: $75.90\n\nStock: TROW\nCurrent Price: $111.765\nStop Price from get_stop(): $108.68\nTrailing Percentage (from difference): 2.76%\nSymbol: TROW, Quantity: 4.62, Stop Price: 108.68, Limit Price: 108.18\nFirst target price not yet reached for TROW, setting stop loss order.\nCurrent Price: $111.77, Target Price 1: $113.96\n\nStock: TW\nCurrent Price: $132.47\nStop Price from get_stop(): $130.94\nTrailing Percentage (from difference): 1.15%\nFirst target price reached for TW, setting stop loss order for half at $132.16.\nCurrent Price: $132.47, Target Price 1: $127.25\n\nStock: CF\nCurrent Price: $83.235\nStop Price from get_stop(): $80.56\nTrailing Percentage (from difference): 3.21%\nSymbol: CF, Quantity: 1.72, Stop Price: 80.56, Limit Price: 80.06\nFirst target price not yet reached for CF, setting stop loss order.\nCurrent Price: $83.23, Target Price 1: $88.24\n\nStock: NSP\nCurrent Price: $80.45\nStop Price from get_stop(): $84.46\nTrailing Percentage (from difference): -4.98%\nSymbol: NSP, Quantity: 0.34, Stop Price: 84.46, Limit Price: 83.96\nSkipping order for NSP because quantity to sell is less than 1.\nFirst target price not yet reached for NSP, setting stop loss order.\nCurrent Price: $80.45, Target Price 1: $95.88\n\nStock: TKR\nCurrent Price: $84.925\nStop Price from get_stop(): $82.14\nTrailing Percentage (from difference): 3.28%\nSymbol: TKR, Quantity: 0.73, Stop Price: 82.14, Limit Price: 81.64\nSkipping order for TKR because quantity to sell is less than 1.\nFirst target price not yet reached for TKR, setting stop loss order.\nCurrent Price: $84.92, Target Price 1: $88.08\n\nStock: CALM\nCurrent Price: $90.035\nStop Price from get_stop(): $89.36\nTrailing Percentage (from difference): 0.75%\nFirst target price reached for CALM, setting stop loss order for half at $89.90.\nCurrent Price: $90.03, Target Price 1: $75.98\n\nStock: CI\nCurrent Price: $318.54\nStop Price from get_stop(): $313.0\nTrailing Percentage (from difference): 1.74%\nSymbol: CI, Quantity: 1.42, Stop Price: 313.0, Limit Price: 312.5\nFirst target price not yet reached for CI, setting stop loss order.\nCurrent Price: $318.54, Target Price 1: $369.82\n\nStock: BPOP\nCurrent Price: $88.65\nStop Price from get_stop(): $86.44\nTrailing Percentage (from difference): 2.49%\nSymbol: BPOP, Quantity: 0.86, Stop Price: 86.44, Limit Price: 85.94\nSkipping order for BPOP because quantity to sell is less than 1.\nFirst target price not yet reached for BPOP, setting stop loss order.\nCurrent Price: $88.65, Target Price 1: $107.86\n\nStock: WFRD\nCurrent Price: $80.11\nStop Price from get_stop(): $76.5\nTrailing Percentage (from difference): 4.51%\nSymbol: WFRD, Quantity: 0.18, Stop Price: 76.5, Limit Price: 76.0\nSkipping order for WFRD because quantity to sell is less than 1.\nFirst target price not yet reached for WFRD, setting stop loss order.\nCurrent Price: $80.11, Target Price 1: $99.74\n\nStock: CBSH\nCurrent Price: $61.31\nStop Price from get_stop(): $59.94\nTrailing Percentage (from difference): 2.23%\nSymbol: CBSH, Quantity: 6.23, Stop Price: 59.94, Limit Price: 59.44\nFirst target price not yet reached for CBSH, setting stop loss order.\nCurrent Price: $61.31, Target Price 1: $66.85\n\nStock: ALV\nCurrent Price: $95.33\nStop Price from get_stop(): $94.2\nTrailing Percentage (from difference): 1.19%\nSymbol: ALV, Quantity: 0.02, Stop Price: 94.2, Limit Price: 93.7\nSkipping order for ALV because quantity to sell is less than 1.\nFirst target price not yet reached for ALV, setting stop loss order.\nCurrent Price: $95.33, Target Price 1: $103.74\n\nStock: AIN\nCurrent Price: $71.65\nStop Price from get_stop(): $70.92\nTrailing Percentage (from difference): 1.02%\nSymbol: AIN, Quantity: 4.46, Stop Price: 70.92, Limit Price: 70.42\nFirst target price not yet reached for AIN, setting stop loss order.\nCurrent Price: $71.65, Target Price 1: $93.42\n\nStock: MLM\nCurrent Price: $570.115\nStop Price from get_stop(): $566.72\nTrailing Percentage (from difference): 0.60%\nFirst target price reached for MLM, Current Price: $570.12, with a gain of 6.52%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: DCI\nCurrent Price: $75.08\nStop Price from get_stop(): $72.44\nTrailing Percentage (from difference): 3.52%\nSymbol: DCI, Quantity: 5.4, Stop Price: 72.44, Limit Price: 71.94\nFirst target price not yet reached for DCI, setting stop loss order.\nCurrent Price: $75.08, Target Price 1: $77.15\n\nStock: ADM\nCurrent Price: $56.495\nStop Price from get_stop(): $55.01\nTrailing Percentage (from difference): 2.63%\nSymbol: ADM, Quantity: 0.39, Stop Price: 55.01, Limit Price: 54.51\nSkipping order for ADM because quantity to sell is less than 1.\nFirst target price not yet reached for ADM, setting stop loss order.\nCurrent Price: $56.49, Target Price 1: $65.28\n\nStock: VLO\nCurrent Price: $132.695\nStop Price from get_stop(): $130.34\nTrailing Percentage (from difference): 1.77%\nSymbol: VLO, Quantity: 0.83, Stop Price: 130.34, Limit Price: 129.84\nSkipping order for VLO because quantity to sell is less than 1.\nFirst target price not yet reached for VLO, setting stop loss order.\nCurrent Price: $132.69, Target Price 1: $147.33\n\nStock: HXL\nCurrent Price: $62.68\nStop Price from get_stop(): $62.29\nTrailing Percentage (from difference): 0.62%\nSymbol: HXL, Quantity: 0.47, Stop Price: 62.29, Limit Price: 61.79\nSkipping order for HXL because quantity to sell is less than 1.\nFirst target price not yet reached for HXL, setting stop loss order.\nCurrent Price: $62.68, Target Price 1: $64.46\n\nStock: CHRD\nCurrent Price: $127.86\nStop Price from get_stop(): $123.49\nTrailing Percentage (from difference): 3.42%\nSymbol: CHRD, Quantity: 0.85, Stop Price: 123.49, Limit Price: 122.99\nSkipping order for CHRD because quantity to sell is less than 1.\nFirst target price not yet reached for CHRD, setting stop loss order.\nCurrent Price: $127.86, Target Price 1: $145.98\n\nStock: HES\nCurrent Price: $138.5\nStop Price from get_stop(): $134.66\nTrailing Percentage (from difference): 2.77%\nSymbol: HES, Quantity: 3.61, Stop Price: 134.66, Limit Price: 134.16\nFirst target price not yet reached for HES, setting stop loss order.\nCurrent Price: $138.50, Target Price 1: $146.02\n\nStock: GBCI\nCurrent Price: $49.47\nStop Price from get_stop(): $47.28\nTrailing Percentage (from difference): 4.43%\nSymbol: GBCI, Quantity: 13.31, Stop Price: 47.28, Limit Price: 46.78\nFirst target price not yet reached for GBCI, setting stop loss order.\nCurrent Price: $49.47, Target Price 1: $52.46\n\nStock: WDAY\nCurrent Price: $239.5764\nStop Price from get_stop(): $235.08\nTrailing Percentage (from difference): 1.88%\nSymbol: WDAY, Quantity: 2.03, Stop Price: 235.08, Limit Price: 234.58\nFirst target price not yet reached for WDAY, setting stop loss order.\nCurrent Price: $239.58, Target Price 1: $258.87\n\nStock: STT\nCurrent Price: $91.04\nStop Price from get_stop(): $90.64\nTrailing Percentage (from difference): 0.44%\nSymbol: STT, Quantity: 5.57, Stop Price: 90.64, Limit Price: 90.14\nFirst target price not yet reached for STT, setting stop loss order.\nCurrent Price: $91.04, Target Price 1: $94.47\n\nStock: DELL\nCurrent Price: $123.445\nStop Price from get_stop(): $117.4\nTrailing Percentage (from difference): 4.90%\nSymbol: DELL, Quantity: 4.0, Stop Price: 117.4, Limit Price: 116.9\nFirst target price not yet reached for DELL, setting stop loss order.\nCurrent Price: $123.44, Target Price 1: $131.51\n\nStock: AIG\nCurrent Price: $77.01\nStop Price from get_stop(): $76.1\nTrailing Percentage (from difference): 1.18%\nSymbol: AIG, Quantity: 5.32, Stop Price: 76.1, Limit Price: 75.6\nFirst target price not yet reached for AIG, setting stop loss order.\nCurrent Price: $77.01, Target Price 1: $78.30\n\nStock: LYB\nCurrent Price: $87.95\nStop Price from get_stop(): $86.12\nTrailing Percentage (from difference): 2.08%\nSymbol: LYB, Quantity: 0.13, Stop Price: 86.12, Limit Price: 85.62\nSkipping order for LYB because quantity to sell is less than 1.\nFirst target price not yet reached for LYB, setting stop loss order.\nCurrent Price: $87.95, Target Price 1: $100.81\n"}, {"name": "stdout", "output_type": "stream", "text": "\nStock: BERY\nCurrent Price: $68.12\nStop Price from get_stop(): $66.4\nTrailing Percentage (from difference): 2.52%\nSymbol: BERY, Quantity: 5.73, Stop Price: 66.4, Limit Price: 65.9\nFirst target price not yet reached for BERY, setting stop loss order.\nCurrent Price: $68.12, Target Price 1: $72.69\n\nStock: PPG\nCurrent Price: $126.58\nStop Price from get_stop(): $123.8\nTrailing Percentage (from difference): 2.20%\nSymbol: PPG, Quantity: 0.05, Stop Price: 123.8, Limit Price: 123.3\nSkipping order for PPG because quantity to sell is less than 1.\nFirst target price not yet reached for PPG, setting stop loss order.\nCurrent Price: $126.58, Target Price 1: $136.86\n\nStock: TM\nCurrent Price: $172.4\nStop Price from get_stop(): $167.23\nTrailing Percentage (from difference): 3.00%\nSymbol: TM, Quantity: 2.14, Stop Price: 167.23, Limit Price: 166.73\nFirst target price not yet reached for TM, setting stop loss order.\nCurrent Price: $172.40, Target Price 1: $194.63\n\nStock: COP\nCurrent Price: $104.59\nStop Price from get_stop(): $101.75\nTrailing Percentage (from difference): 2.72%\nSymbol: COP, Quantity: 0.55, Stop Price: 101.75, Limit Price: 101.25\nSkipping order for COP because quantity to sell is less than 1.\nFirst target price not yet reached for COP, setting stop loss order.\nCurrent Price: $104.59, Target Price 1: $117.48\n\nStock: EWBC\nCurrent Price: $94.69\nStop Price from get_stop(): $96.28\nTrailing Percentage (from difference): -1.68%\nFirst target price reached for EWBC, setting stop loss order for half at $95.01.\nCurrent Price: $94.69, Target Price 1: $87.65\n\nStock: SSNC\nCurrent Price: $69.67\nStop Price from get_stop(): $73.84\nTrailing Percentage (from difference): -5.99%\nSymbol: SSNC, Quantity: 5.17, Stop Price: 73.84, Limit Price: 73.34\nFirst target price not yet reached for SSNC, setting stop loss order.\nCurrent Price: $69.67, Target Price 1: $80.64\n\nStock: NOW\nCurrent Price: $952.07\nStop Price from get_stop(): $947.32\nTrailing Percentage (from difference): 0.50%\nSymbol: NOW, Quantity: 0.527, Stop Price: 947.32, Limit Price: 946.82\nSkipping order for NOW because quantity to sell is less than 1.\nFirst target price not yet reached for NOW, setting stop loss order.\nCurrent Price: $952.07, Target Price 1: $999.13\n\nStock: OMAB\nCurrent Price: $66.29\nStop Price from get_stop(): $64.82\nTrailing Percentage (from difference): 2.22%\nSymbol: OMAB, Quantity: 9.91, Stop Price: 64.81, Limit Price: 64.31\nFirst target price not yet reached for OMAB, setting stop loss order.\nCurrent Price: $66.29, Target Price 1: $70.52\n\nStock: XLK\nCurrent Price: $232.1258\nStop Price from get_stop(): $225.94\nTrailing Percentage (from difference): 2.66%\nSymbol: XLK, Quantity: 2.84, Stop Price: 225.94, Limit Price: 225.44\nFirst target price not yet reached for XLK, setting stop loss order.\nCurrent Price: $232.13, Target Price 1: $245.64\n\nStock: KB\nCurrent Price: $72.47\nStop Price from get_stop(): $66.51\nTrailing Percentage (from difference): 8.22%\nFirst target price reached for KB, setting stop loss order for half at $71.28.\nCurrent Price: $72.47, Target Price 1: $66.27\n\nStock: WST\nCurrent Price: $311.31\nStop Price from get_stop(): $325.15\nTrailing Percentage (from difference): -4.45%\nSymbol: WST, Quantity: 0.64, Stop Price: 325.15, Limit Price: 324.65\nSkipping order for WST because quantity to sell is less than 1.\nFirst target price not yet reached for WST, setting stop loss order.\nCurrent Price: $311.31, Target Price 1: $328.01\n\nStock: ODFL\nCurrent Price: $197.86\nStop Price from get_stop(): $190.6\nTrailing Percentage (from difference): 3.67%\nSymbol: ODFL, Quantity: 0.92, Stop Price: 190.6, Limit Price: 190.1\nSkipping order for ODFL because quantity to sell is less than 1.\nFirst target price not yet reached for ODFL, setting stop loss order.\nCurrent Price: $197.86, Target Price 1: $217.27\n\nStock: LNW\nCurrent Price: $94.76\nStop Price from get_stop(): $91.71\nTrailing Percentage (from difference): 3.22%\nSymbol: LNW, Quantity: 7.0, Stop Price: 91.71, Limit Price: 91.21\nFirst target price not yet reached for LNW, setting stop loss order.\nCurrent Price: $94.76, Target Price 1: $99.75\n\nStock: IDXX\nCurrent Price: $452.83\nStop Price from get_stop(): $441.18\nTrailing Percentage (from difference): 2.57%\nSymbol: IDXX, Quantity: 0.69, Stop Price: 441.18, Limit Price: 440.68\nSkipping order for IDXX because quantity to sell is less than 1.\nFirst target price not yet reached for IDXX, setting stop loss order.\nCurrent Price: $452.83, Target Price 1: $510.13\n\nStock: POWI\nCurrent Price: $63.93\nStop Price from get_stop(): $60.54\nTrailing Percentage (from difference): 5.30%\nSymbol: POWI, Quantity: 10.28, Stop Price: 60.54, Limit Price: 60.04\nFirst target price not yet reached for POWI, setting stop loss order.\nCurrent Price: $63.93, Target Price 1: $67.96\n\nStock: RMBS\nCurrent Price: $43.65\nStop Price from get_stop(): $40.8\nTrailing Percentage (from difference): 6.53%\nSymbol: RMBS, Quantity: 15.18, Stop Price: 40.8, Limit Price: 40.3\nFirst target price not yet reached for RMBS, setting stop loss order.\nCurrent Price: $43.65, Target Price 1: $46.03\n\nStock: UNF\nCurrent Price: $189.495\nStop Price from get_stop(): $187.23\nTrailing Percentage (from difference): 1.20%\nSymbol: UNF, Quantity: 0.48, Stop Price: 187.23, Limit Price: 186.73\nSkipping order for UNF because quantity to sell is less than 1.\nFirst target price not yet reached for UNF, setting stop loss order.\nCurrent Price: $189.50, Target Price 1: $200.50\n\nStock: MKSI\nCurrent Price: $101.46\nStop Price from get_stop(): $96.31\nTrailing Percentage (from difference): 5.08%\nSymbol: MKSI, Quantity: 0.47, Stop Price: 96.31, Limit Price: 95.81\nSkipping order for MKSI because quantity to sell is less than 1.\nFirst target price not yet reached for MKSI, setting stop loss order.\nCurrent Price: $101.46, Target Price 1: $120.16\n\nStock: PSX\nCurrent Price: $128.98\nStop Price from get_stop(): $124.42\nTrailing Percentage (from difference): 3.54%\nSymbol: PSX, Quantity: 0.97, Stop Price: 124.42, Limit Price: 123.92\nSkipping order for PSX because quantity to sell is less than 1.\nFirst target price not yet reached for PSX, setting stop loss order.\nCurrent Price: $128.98, Target Price 1: $140.16\n\nStock: PNFP\nCurrent Price: $100.825\nStop Price from get_stop(): $102.41\nTrailing Percentage (from difference): -1.57%\nSymbol: PNFP, Quantity: 3.96, Stop Price: 102.41, Limit Price: 101.91\nFirst target price not yet reached for PNFP, setting stop loss order.\nCurrent Price: $100.83, Target Price 1: $105.22\n\nStock: VEEV\nCurrent Price: $212.79\nStop Price from get_stop(): $211.4\nTrailing Percentage (from difference): 0.65%\nSymbol: VEEV, Quantity: 2.38, Stop Price: 211.41, Limit Price: 210.91\nFirst target price not yet reached for VEEV, setting stop loss order.\nCurrent Price: $212.79, Target Price 1: $220.70\n\nStock: VC\nCurrent Price: $92.93\nStop Price from get_stop(): $91.05\nTrailing Percentage (from difference): 2.02%\nSymbol: VC, Quantity: 7.1, Stop Price: 91.05, Limit Price: 90.55\nFirst target price not yet reached for VC, setting stop loss order.\nCurrent Price: $92.93, Target Price 1: $98.32\n\nStock: WMS\nCurrent Price: $150.515\nStop Price from get_stop(): $146.32\nTrailing Percentage (from difference): 2.79%\nSymbol: WMS, Quantity: 0.54, Stop Price: 146.32, Limit Price: 145.82\nSkipping order for WMS because quantity to sell is less than 1.\nFirst target price not yet reached for WMS, setting stop loss order.\nCurrent Price: $150.51, Target Price 1: $164.26\n\nStock: SQM\nCurrent Price: $41.16\nStop Price from get_stop(): $40.12\nTrailing Percentage (from difference): 2.53%\nSymbol: SQM, Quantity: 16.01, Stop Price: 40.12, Limit Price: 39.62\nFirst target price not yet reached for SQM, setting stop loss order.\nCurrent Price: $41.16, Target Price 1: $43.62\n\nStock: NKE\nCurrent Price: $79.112\nStop Price from get_stop(): $76.96\nTrailing Percentage (from difference): 2.72%\nSymbol: NKE, Quantity: 0.82, Stop Price: 76.96, Limit Price: 76.46\nSkipping order for NKE because quantity to sell is less than 1.\nFirst target price not yet reached for NKE, setting stop loss order.\nCurrent Price: $79.11, Target Price 1: $86.51\n\nStock: NTES\nCurrent Price: $80.165\nStop Price from get_stop(): $76.76\nTrailing Percentage (from difference): 4.25%\nSymbol: NTES, Quantity: 2.0, Stop Price: 76.76, Limit Price: 76.26\n"}, {"name": "stdout", "output_type": "stream", "text": "First target price not yet reached for NTES, setting stop loss order.\nCurrent Price: $80.17, Target Price 1: $83.45\n\nStock: PRI\nCurrent Price: $274.83\nStop Price from get_stop(): $273.03\nTrailing Percentage (from difference): 0.65%\nFirst target price reached for PRI, Current Price: $274.83, with a gain of 6.40%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: NRG\nCurrent Price: $88.625\nStop Price from get_stop(): $88.61\nTrailing Percentage (from difference): 0.02%\nFirst target price reached for NRG, Current Price: $88.62, with a gain of 8.47%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: ALSN\nCurrent Price: $99.16\nStop Price from get_stop(): $96.24\nTrailing Percentage (from difference): 2.94%\nFirst target price reached for ALSN, Current Price: $99.16, with a gain of 9.44%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: WIX\nCurrent Price: $165.7\nStop Price from get_stop(): $157.62\nTrailing Percentage (from difference): 4.88%\nSymbol: WIX, Quantity: 2.97, Stop Price: 157.62, Limit Price: 157.12\nFirst target price not yet reached for WIX, setting stop loss order.\nCurrent Price: $165.70, Target Price 1: $177.02\n\nStock: VRTX\nCurrent Price: $478.22\nStop Price from get_stop(): $464.92\nTrailing Percentage (from difference): 2.78%\nSymbol: VRTX, Quantity: 1.05, Stop Price: 464.92, Limit Price: 464.42\nFirst target price not yet reached for VRTX, setting stop loss order.\nCurrent Price: $478.22, Target Price 1: $501.93\n\nStock: ICLR\nCurrent Price: $227.61\nStop Price from get_stop(): $217.82\nTrailing Percentage (from difference): 4.30%\nSymbol: ICLR, Quantity: 1.67, Stop Price: 217.82, Limit Price: 217.32\nFirst target price not yet reached for ICLR, setting stop loss order.\nCurrent Price: $227.61, Target Price 1: $315.08\n\nStock: TX\nCurrent Price: $35.45\nStop Price from get_stop(): $34.86\nTrailing Percentage (from difference): 1.66%\nSymbol: TX, Quantity: 18.58, Stop Price: 34.86, Limit Price: 34.36\nFirst target price not yet reached for TX, setting stop loss order.\nCurrent Price: $35.45, Target Price 1: $37.57\n\nStock: LFUS\nCurrent Price: $254.32\nStop Price from get_stop(): $248.59\nTrailing Percentage (from difference): 2.25%\nSymbol: LFUS, Quantity: 0.98, Stop Price: 248.59, Limit Price: 248.09\nSkipping order for LFUS because quantity to sell is less than 1.\nFirst target price not yet reached for LFUS, setting stop loss order.\nCurrent Price: $254.32, Target Price 1: $271.28\n\nStock: NDSN\nCurrent Price: $249.2\nStop Price from get_stop(): $245.08\nTrailing Percentage (from difference): 1.65%\nSymbol: NDSN, Quantity: 0.97, Stop Price: 245.08, Limit Price: 244.58\nSkipping order for NDSN because quantity to sell is less than 1.\nFirst target price not yet reached for NDSN, setting stop loss order.\nCurrent Price: $249.20, Target Price 1: $272.25\n\nStock: JOE\nCurrent Price: $53.205\nStop Price from get_stop(): $52.51\nTrailing Percentage (from difference): 1.31%\nSymbol: JOE, Quantity: 0.47, Stop Price: 52.51, Limit Price: 52.01\nSkipping order for JOE because quantity to sell is less than 1.\nFirst target price not yet reached for JOE, setting stop loss order.\nCurrent Price: $53.20, Target Price 1: $64.36\n\nStock: MMS\nCurrent Price: $87.46\nStop Price from get_stop(): $86.06\nTrailing Percentage (from difference): 1.60%\nSymbol: MMS, Quantity: 0.43, Stop Price: 86.06, Limit Price: 85.56\nSkipping order for MMS because quantity to sell is less than 1.\nFirst target price not yet reached for MMS, setting stop loss order.\nCurrent Price: $87.46, Target Price 1: $94.03\n\nStock: THO\nCurrent Price: $104.1059\nStop Price from get_stop(): $102.16\nTrailing Percentage (from difference): 1.87%\nSymbol: THO, Quantity: 0.69, Stop Price: 102.16, Limit Price: 101.66\nSkipping order for THO because quantity to sell is less than 1.\nFirst target price not yet reached for THO, setting stop loss order.\nCurrent Price: $104.11, Target Price 1: $112.88\n\nStock: VDE\nCurrent Price: $125.345\nStop Price from get_stop(): $122.9\nTrailing Percentage (from difference): 1.95%\nSymbol: VDE, Quantity: 3.15, Stop Price: 122.9, Limit Price: 122.4\nFirst target price not yet reached for VDE, setting stop loss order.\nCurrent Price: $125.34, Target Price 1: $132.31\n\nStock: VEU\nCurrent Price: $60.865\nStop Price from get_stop(): $60.22\nTrailing Percentage (from difference): 1.06%\nSymbol: VEU, Quantity: 0.36, Stop Price: 60.22, Limit Price: 59.72\nSkipping order for VEU because quantity to sell is less than 1.\nFirst target price not yet reached for VEU, setting stop loss order.\nCurrent Price: $60.87, Target Price 1: $65.53\n\nStock: VGK\nCurrent Price: $68.355\nStop Price from get_stop(): $67.58\nTrailing Percentage (from difference): 1.13%\nSymbol: VGK, Quantity: 0.55, Stop Price: 67.58, Limit Price: 67.08\nSkipping order for VGK because quantity to sell is less than 1.\nFirst target price not yet reached for VGK, setting stop loss order.\nCurrent Price: $68.36, Target Price 1: $75.06\n\nStock: TEL\nCurrent Price: $148.62\nStop Price from get_stop(): $144.28\nTrailing Percentage (from difference): 2.92%\nSymbol: TEL, Quantity: 2.64, Stop Price: 144.28, Limit Price: 143.78\nFirst target price not yet reached for TEL, setting stop loss order.\nCurrent Price: $148.62, Target Price 1: $157.86\n\nStock: ACA\nCurrent Price: $93.76\nStop Price from get_stop(): $93.2\nTrailing Percentage (from difference): 0.60%\nSymbol: ACA, Quantity: 0.01, Stop Price: 93.2, Limit Price: 92.7\nSkipping order for ACA because quantity to sell is less than 1.\nFirst target price not yet reached for ACA, setting stop loss order.\nCurrent Price: $93.76, Target Price 1: $99.47\n\nStock: LRCX\nCurrent Price: $79.162\nStop Price from get_stop(): $75.72\nTrailing Percentage (from difference): 4.35%\nSymbol: LRCX, Quantity: 8.35, Stop Price: 75.72, Limit Price: 75.22\nFirst target price not yet reached for LRCX, setting stop loss order.\nCurrent Price: $79.16, Target Price 1: $83.64\n\nStock: VNQ\nCurrent Price: $96.325\nStop Price from get_stop(): $95.64\nTrailing Percentage (from difference): 0.71%\nSymbol: VNQ, Quantity: 6.84, Stop Price: 95.64, Limit Price: 95.14\nFirst target price not yet reached for VNQ, setting stop loss order.\nCurrent Price: $96.33, Target Price 1: $102.20\n\nStock: WFG\nCurrent Price: $97.825\nStop Price from get_stop(): $94.43\nTrailing Percentage (from difference): 3.47%\nSymbol: WFG, Quantity: 6.71, Stop Price: 94.43, Limit Price: 93.93\nFirst target price not yet reached for WFG, setting stop loss order.\nCurrent Price: $97.83, Target Price 1: $104.03\nEnding main loop iteration...\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\n"}, {"name": "stdout", "output_type": "stream", "text": "Market is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\n"}, {"name": "stdout", "output_type": "stream", "text": "Market is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\nMarket is open.\nFound Additional pages.\nLoading page 2 ...\nLoading page 3 ...\nLoading page 4 ...\nLoading page 5 ...\nLoading page 6 ...\nLoading page 7 ...\nLoading page 8 ...\nLoading page 9 ...\nLoading page 10 ...\nLoading page 11 ...\nLoading page 12 ...\nLoading page 13 ...\nLoading page 14 ...\nLoading page 15 ...\nLoading page 16 ...\nLoading page 17 ...\nLoading page 18 ...\nLoading page 19 ...\nLoading page 20 ...\nLoading page 21 ...\nLoading page 22 ...\nLoading page 23 ...\nLoading page 24 ...\nLoading page 25 ...\nLoading page 26 ...\nLoading page 27 ...\nLoading page 28 ...\nLoading page 29 ...\nLoading page 30 ...\nLoading page 31 ...\nLoading page 32 ...\nLoading page 33 ...\nLoading page 34 ...\nLoading page 35 ...\nLoading page 36 ...\nLoading page 37 ...\nLoading page 38 ...\nLoading page 39 ...\nLoading page 40 ...\nLoading page 41 ...\nLoading page 42 ...\nLoading page 43 ...\nLoading page 44 ...\nLoading page 45 ...\nLoading page 46 ...\nLoading page 47 ...\nLoading page 48 ...\nLoading page 49 ...\nLoading page 50 ...\nLoading page 51 ...\nLoading page 52 ...\nLoading page 53 ...\nLoading page 54 ...\nLoading page 55 ...\nLoading page 56 ...\nLoading page 57 ...\nLoading page 58 ...\nLoading page 59 ...\nLoading page 60 ...\nLoading page 61 ...\nLoading page 62 ...\nLoading page 63 ...\nLoading page 64 ...\nLoading page 65 ...\nLoading page 66 ...\nLoading page 67 ...\nLoading page 68 ...\nLoading page 69 ...\nLoading page 70 ...\nLoading page 71 ...\nLoading page 72 ...\nLoading page 73 ...\nLoading page 74 ...\nLoading page 75 ...\nLoading page 76 ...\nLoading page 77 ...\nLoading page 78 ...\nLoading page 79 ...\nLoading page 80 ...\nLoading page 81 ...\nLoading page 82 ...\nLoading page 83 ...\nLoading page 84 ...\nLoading page 85 ...\nLoading page 86 ...\nLoading page 87 ...\nLoading page 88 ...\nLoading page 89 ...\nLoading page 90 ...\nLoading page 91 ...\nLoading page 92 ...\nLoading page 93 ...\nLoading page 94 ...\nLoading page 95 ...\nLoading page 96 ...\nLoading page 97 ...\nLoading page 98 ...\nLoading page 99 ...\nLoading page 100 ...\nLoading page 101 ...\nLoading page 102 ...\nLoading page 103 ...\nLoading page 104 ...\nLoading page 105 ...\nLoading page 106 ...\nStarting the loop to process each stock for trailing stop...\n\nStock: AAPL\nCurrent Price: $233.0284\nStop Price from get_stop(): $225.92\nTrailing Percentage (from difference): 3.05%\nSymbol: AAPL, Quantity: 1.72, Stop Price: 225.92, Limit Price: 225.42\nFirst target price not yet reached for AAPL, setting stop loss order.\nCurrent Price: $233.03, Target Price 1: $240.68\n\nStock: TSLA\nCurrent Price: $269.38\nStop Price from get_stop(): $264.52\nTrailing Percentage (from difference): 1.80%\nSymbol: TSLA, Quantity: 2.47, Stop Price: 264.52, Limit Price: 264.02\nFirst target price not yet reached for TSLA, setting stop loss order.\nCurrent Price: $269.38, Target Price 1: $281.57\n\nStock: C\nCurrent Price: $63.04\nStop Price from get_stop(): $61.41\nTrailing Percentage (from difference): 2.59%\nSymbol: C, Quantity: 6.36, Stop Price: 61.41, Limit Price: 60.91\nFirst target price not yet reached for C, setting stop loss order.\nCurrent Price: $63.04, Target Price 1: $65.24\n\nStock: XOM\nCurrent Price: $117.76\nStop Price from get_stop(): $118.08\nTrailing Percentage (from difference): -0.27%\nSymbol: XOM, Quantity: 0.37, Stop Price: 118.08, Limit Price: 117.58\nSkipping order for XOM because quantity to sell is less than 1.\nFirst target price not yet reached for XOM, setting stop loss order.\nCurrent Price: $117.76, Target Price 1: $123.07\n\nStock: ESTC\nCurrent Price: $80.22\nStop Price from get_stop(): $76.78\nTrailing Percentage (from difference): 4.29%\nSymbol: ESTC, Quantity: 6.07, Stop Price: 76.78, Limit Price: 76.28\nFirst target price not yet reached for ESTC, setting stop loss order.\nCurrent Price: $80.22, Target Price 1: $86.23\n\nStock: GILD\nCurrent Price: $88.6\nStop Price from get_stop(): $87.12\nTrailing Percentage (from difference): 1.67%\nSymbol: GILD, Quantity: 7.41, Stop Price: 87.12, Limit Price: 86.62\nFirst target price not yet reached for GILD, setting stop loss order.\nCurrent Price: $88.60, Target Price 1: $93.91\n\nStock: AGCO\nCurrent Price: $101.59\nStop Price from get_stop(): $98.46\nTrailing Percentage (from difference): 3.08%\nSymbol: AGCO, Quantity: 6.52, Stop Price: 98.46, Limit Price: 97.96\nFirst target price not yet reached for AGCO, setting stop loss order.\nCurrent Price: $101.59, Target Price 1: $106.67\n\nStock: EOG\nCurrent Price: $121.47\nStop Price from get_stop(): $119.09\nTrailing Percentage (from difference): 1.96%\nSymbol: EOG, Quantity: 0.11, Stop Price: 119.09, Limit Price: 118.59\nSkipping order for EOG because quantity to sell is less than 1.\nFirst target price not yet reached for EOG, setting stop loss order.\nCurrent Price: $121.47, Target Price 1: $133.53\n\nStock: FANG\nCurrent Price: $179.415\nStop Price from get_stop(): $179.59\nTrailing Percentage (from difference): -0.10%\nSymbol: FANG, Quantity: 0.16, Stop Price: 179.59, Limit Price: 179.09\nSkipping order for FANG because quantity to sell is less than 1.\nFirst target price not yet reached for FANG, setting stop loss order.\nCurrent Price: $179.41, Target Price 1: $191.83\n\nStock: IART\nCurrent Price: $19.39\nStop Price from get_stop(): $18.84\nTrailing Percentage (from difference): 2.84%\nSymbol: IART, Quantity: 26.33, Stop Price: 18.84, Limit Price: 18.34\nFirst target price not yet reached for IART, setting stop loss order.\nCurrent Price: $19.39, Target Price 1: $19.91\n\nStock: DLTR\nCurrent Price: $66.105\nStop Price from get_stop(): $66.06\nTrailing Percentage (from difference): 0.07%\nSymbol: DLTR, Quantity: 9.85, Stop Price: 66.06, Limit Price: 65.56\nFirst target price not yet reached for DLTR, setting stop loss order.\nCurrent Price: $66.11, Target Price 1: $70.62\n\nStock: A\nCurrent Price: $131.065\nStop Price from get_stop(): $126.88\nTrailing Percentage (from difference): 3.19%\nSymbol: A, Quantity: 0.77, Stop Price: 126.88, Limit Price: 126.38\nSkipping order for A because quantity to sell is less than 1.\nFirst target price not yet reached for A, setting stop loss order.\nCurrent Price: $131.06, Target Price 1: $149.84\n\nStock: AME\nCurrent Price: $168.525\nStop Price from get_stop(): $164.7\nTrailing Percentage (from difference): 2.27%\nSymbol: AME, Quantity: 2.3, Stop Price: 164.7, Limit Price: 164.2\nFirst target price not yet reached for AME, setting stop loss order.\nCurrent Price: $168.53, Target Price 1: $180.20\n\nStock: LANC\nCurrent Price: $180.025\nStop Price from get_stop(): $173.87\nTrailing Percentage (from difference): 3.42%\nSymbol: LANC, Quantity: 0.78, Stop Price: 173.87, Limit Price: 173.37\nSkipping order for LANC because quantity to sell is less than 1.\nFirst target price not yet reached for LANC, setting stop loss order.\nCurrent Price: $180.03, Target Price 1: $192.88\n\nStock: TXN\nCurrent Price: $205.71\nStop Price from get_stop(): $201.4\nTrailing Percentage (from difference): 2.10%\nSymbol: TXN, Quantity: 3.17, Stop Price: 201.4, Limit Price: 200.9\nFirst target price not yet reached for TXN, setting stop loss order.\nCurrent Price: $205.71, Target Price 1: $219.71\n\nStock: SYNA\nCurrent Price: $73.0\nStop Price from get_stop(): $69.79\nTrailing Percentage (from difference): 4.40%\nSymbol: SYNA, Quantity: 8.94, Stop Price: 69.79, Limit Price: 69.29\nFirst target price not yet reached for SYNA, setting stop loss order.\nCurrent Price: $73.00, Target Price 1: $77.77\n\nStock: MS\nCurrent Price: $117.995\nStop Price from get_stop(): $116.18\nTrailing Percentage (from difference): 1.54%\nSecond target price reached for MS, setting stop loss order for all at $117.63 with a gain of 17.00%.\nCurrent Price: $118.00, Target Price 2: $110.58, Average Buy Price: $100.85\n\nStock: ULTA\nCurrent Price: $371.28\nStop Price from get_stop(): $363.2\nTrailing Percentage (from difference): 2.18%\nSymbol: ULTA, Quantity: 2.49, Stop Price: 363.2, Limit Price: 362.7\nFirst target price not yet reached for ULTA, setting stop loss order.\nCurrent Price: $371.28, Target Price 1: $394.79\n\nStock: JBHT\nCurrent Price: $176.025\nStop Price from get_stop(): $169.63\nTrailing Percentage (from difference): 3.63%\nSymbol: JBHT, Quantity: 0.25, Stop Price: 169.63, Limit Price: 169.13\nSkipping order for JBHT because quantity to sell is less than 1.\nFirst target price not yet reached for JBHT, setting stop loss order.\nCurrent Price: $176.03, Target Price 1: $184.54\n"}, {"name": "stdout", "output_type": "stream", "text": "\nStock: SLAB\nCurrent Price: $114.84\nStop Price from get_stop(): $110.54\nTrailing Percentage (from difference): 3.74%\nSymbol: SLAB, Quantity: 5.7, Stop Price: 110.54, Limit Price: 110.04\nFirst target price not yet reached for SLAB, setting stop loss order.\nCurrent Price: $114.84, Target Price 1: $122.03\n\nStock: ON\nCurrent Price: $72.3999\nStop Price from get_stop(): $70.74\nTrailing Percentage (from difference): 2.29%\nSymbol: ON, Quantity: 0.21, Stop Price: 70.73, Limit Price: 70.23\nSkipping order for ON because quantity to sell is less than 1.\nFirst target price not yet reached for ON, setting stop loss order.\nCurrent Price: $72.40, Target Price 1: $75.57\n\nStock: TROW\nCurrent Price: $111.865\nStop Price from get_stop(): $108.75\nTrailing Percentage (from difference): 2.78%\nSymbol: TROW, Quantity: 4.62, Stop Price: 108.75, Limit Price: 108.25\nFirst target price not yet reached for TROW, setting stop loss order.\nCurrent Price: $111.86, Target Price 1: $113.46\n\nStock: TW\nCurrent Price: $133.07\nStop Price from get_stop(): $129.28\nTrailing Percentage (from difference): 2.85%\nSecond target price reached for TW, setting stop loss order for all at $132.31 with a gain of 10.66%.\nCurrent Price: $133.07, Target Price 2: $131.85, Average Buy Price: $120.25\n\nStock: CF\nCurrent Price: $82.36\nStop Price from get_stop(): $81.5\nTrailing Percentage (from difference): 1.04%\nSymbol: CF, Quantity: 1.72, Stop Price: 81.5, Limit Price: 81.0\nFirst target price not yet reached for CF, setting stop loss order.\nCurrent Price: $82.36, Target Price 1: $87.86\n\nStock: NSP\nCurrent Price: $78.715\nStop Price from get_stop(): $76.32\nTrailing Percentage (from difference): 3.04%\nSymbol: NSP, Quantity: 0.34, Stop Price: 76.32, Limit Price: 75.82\nSkipping order for NSP because quantity to sell is less than 1.\nFirst target price not yet reached for NSP, setting stop loss order.\nCurrent Price: $78.72, Target Price 1: $95.46\n\nStock: TKR\nCurrent Price: $85.88\nStop Price from get_stop(): $82.96\nTrailing Percentage (from difference): 3.40%\nSymbol: TKR, Quantity: 0.73, Stop Price: 82.96, Limit Price: 82.46\nSkipping order for TKR because quantity to sell is less than 1.\nFirst target price not yet reached for TKR, setting stop loss order.\nCurrent Price: $85.88, Target Price 1: $87.69\n\nStock: CALM\nCurrent Price: $89.67\nStop Price from get_stop(): $87.79\nTrailing Percentage (from difference): 2.10%\nSecond target price reached for CALM, Current Price: $89.67 with a gain of 24.88%.\nDue to low initial funding, the entire position in this stock has been sold for profit.\n\nStock: CI\nCurrent Price: $313.795\nStop Price from get_stop(): $309.15\nTrailing Percentage (from difference): 1.48%\nSymbol: CI, Quantity: 1.42, Stop Price: 309.15, Limit Price: 308.65\nFirst target price not yet reached for CI, setting stop loss order.\nCurrent Price: $313.80, Target Price 1: $368.20\n\nStock: BPOP\nCurrent Price: $89.09\nStop Price from get_stop(): $86.99\nTrailing Percentage (from difference): 2.36%\nSymbol: BPOP, Quantity: 0.86, Stop Price: 86.99, Limit Price: 86.49\nSkipping order for BPOP because quantity to sell is less than 1.\nFirst target price not yet reached for BPOP, setting stop loss order.\nCurrent Price: $89.09, Target Price 1: $107.39\n\nStock: WFRD\nCurrent Price: $79.345\nStop Price from get_stop(): $79.32\nTrailing Percentage (from difference): 0.03%\nSymbol: WFRD, Quantity: 0.18, Stop Price: 79.32, Limit Price: 78.82\nSkipping order for WFRD because quantity to sell is less than 1.\nFirst target price not yet reached for WFRD, setting stop loss order.\nCurrent Price: $79.34, Target Price 1: $99.30\n\nStock: CBSH\nCurrent Price: $61.67\nStop Price from get_stop(): $60.19\nTrailing Percentage (from difference): 2.40%\nSymbol: CBSH, Quantity: 6.23, Stop Price: 60.19, Limit Price: 59.69\nFirst target price not yet reached for CBSH, setting stop loss order.\nCurrent Price: $61.67, Target Price 1: $66.56\n\nStock: ALV\nCurrent Price: $95.46\nStop Price from get_stop(): $93.18\nTrailing Percentage (from difference): 2.39%\nSymbol: ALV, Quantity: 0.02, Stop Price: 93.18, Limit Price: 92.68\nSkipping order for ALV because quantity to sell is less than 1.\nFirst target price not yet reached for ALV, setting stop loss order.\nCurrent Price: $95.46, Target Price 1: $103.29\n\nStock: AIN\nCurrent Price: $72.665\nStop Price from get_stop(): $69.22\nTrailing Percentage (from difference): 4.74%\nSymbol: AIN, Quantity: 4.46, Stop Price: 69.22, Limit Price: 68.72\nFirst target price not yet reached for AIN, setting stop loss order.\nCurrent Price: $72.67, Target Price 1: $93.01\n\nStock: DCI\nCurrent Price: $75.28\nStop Price from get_stop(): $73.77\nTrailing Percentage (from difference): 2.01%\nSymbol: DCI, Quantity: 5.4, Stop Price: 73.77, Limit Price: 73.27\nFirst target price not yet reached for DCI, setting stop loss order.\nCurrent Price: $75.28, Target Price 1: $76.81\n\nStock: ADM\nCurrent Price: $56.64\nStop Price from get_stop(): $55.54\nTrailing Percentage (from difference): 1.94%\nSymbol: ADM, Quantity: 0.39, Stop Price: 55.54, Limit Price: 55.04\nSkipping order for ADM because quantity to sell is less than 1.\nFirst target price not yet reached for ADM, setting stop loss order.\nCurrent Price: $56.64, Target Price 1: $64.99\n\nStock: VLO\nCurrent Price: $131.75\nStop Price from get_stop(): $129.45\nTrailing Percentage (from difference): 1.75%\nSymbol: VLO, Quantity: 0.83, Stop Price: 129.45, Limit Price: 128.95\nSkipping order for VLO because quantity to sell is less than 1.\nFirst target price not yet reached for VLO, setting stop loss order.\nCurrent Price: $131.75, Target Price 1: $146.69\n\nStock: HXL\nCurrent Price: $62.92\nStop Price from get_stop(): $61.05\nTrailing Percentage (from difference): 2.97%\nSymbol: HXL, Quantity: 0.47, Stop Price: 61.05, Limit Price: 60.55\nSkipping order for HXL because quantity to sell is less than 1.\nFirst target price not yet reached for HXL, setting stop loss order.\nCurrent Price: $62.92, Target Price 1: $64.18\n\nStock: CHRD\nCurrent Price: $126.0801\nStop Price from get_stop(): $125.37\nTrailing Percentage (from difference): 0.56%\nSymbol: CHRD, Quantity: 0.85, Stop Price: 125.37, Limit Price: 124.87\nSkipping order for CHRD because quantity to sell is less than 1.\nFirst target price not yet reached for CHRD, setting stop loss order.\nCurrent Price: $126.08, Target Price 1: $145.34\n\nStock: HES\nCurrent Price: $136.81\nStop Price from get_stop(): $135.48\nTrailing Percentage (from difference): 0.97%\nSymbol: HES, Quantity: 0.61, Stop Price: 135.48, Limit Price: 134.98\nSkipping order for HES because quantity to sell is less than 1.\nFirst target price not yet reached for HES, setting stop loss order.\nCurrent Price: $136.81, Target Price 1: $145.38\n\nStock: GBCI\nCurrent Price: $49.78\nStop Price from get_stop(): $48.99\nTrailing Percentage (from difference): 1.59%\nSymbol: GBCI, Quantity: 13.31, Stop Price: 48.99, Limit Price: 48.49\nFirst target price not yet reached for GBCI, setting stop loss order.\nCurrent Price: $49.78, Target Price 1: $52.23\n\nStock: WDAY\nCurrent Price: $238.56\nStop Price from get_stop(): $230.88\nTrailing Percentage (from difference): 3.22%\nSymbol: WDAY, Quantity: 2.03, Stop Price: 230.88, Limit Price: 230.38\nFirst target price not yet reached for WDAY, setting stop loss order.\nCurrent Price: $238.56, Target Price 1: $257.74\n\nStock: STT\nCurrent Price: $91.8676\nStop Price from get_stop(): $87.72\nTrailing Percentage (from difference): 4.51%\nSymbol: STT, Quantity: 0.57, Stop Price: 87.72, Limit Price: 87.22\nSkipping order for STT because quantity to sell is less than 1.\nFirst target price not yet reached for STT, setting stop loss order.\nCurrent Price: $91.87, Target Price 1: $94.06\n\nStock: DELL\nCurrent Price: $122.9999\nStop Price from get_stop(): $118.47\nTrailing Percentage (from difference): 3.68%\nSymbol: DELL, Quantity: 4.0, Stop Price: 118.47, Limit Price: 117.97\nFirst target price not yet reached for DELL, setting stop loss order.\nCurrent Price: $123.00, Target Price 1: $130.94\n\nStock: AIG\nCurrent Price: $77.745\nStop Price from get_stop(): $74.44\nTrailing Percentage (from difference): 4.25%\nSymbol: AIG, Quantity: 5.32, Stop Price: 74.44, Limit Price: 73.94\nFirst target price not yet reached for AIG, setting stop loss order.\nCurrent Price: $77.75, Target Price 1: $77.96\n\nStock: LYB\nCurrent Price: $87.16\nStop Price from get_stop(): $86.11\nTrailing Percentage (from difference): 1.20%\nSymbol: LYB, Quantity: 0.13, Stop Price: 86.11, Limit Price: 85.61\nSkipping order for LYB because quantity to sell is less than 1.\nFirst target price not yet reached for LYB, setting stop loss order.\nCurrent Price: $87.16, Target Price 1: $100.37\n"}, {"name": "stdout", "output_type": "stream", "text": "\nStock: BERY\nCurrent Price: $68.66\nStop Price from get_stop(): $66.65\nTrailing Percentage (from difference): 2.93%\nSymbol: BERY, Quantity: 5.73, Stop Price: 66.65, Limit Price: 66.15\nFirst target price not yet reached for BERY, setting stop loss order.\nCurrent Price: $68.66, Target Price 1: $72.37\n\nStock: PPG\nCurrent Price: $127.705\nStop Price from get_stop(): $124.68\nTrailing Percentage (from difference): 2.37%\nSymbol: PPG, Quantity: 0.05, Stop Price: 124.68, Limit Price: 124.18\nSkipping order for PPG because quantity to sell is less than 1.\nFirst target price not yet reached for PPG, setting stop loss order.\nCurrent Price: $127.70, Target Price 1: $136.26\n\nStock: TM\nCurrent Price: $175.38\nStop Price from get_stop(): $170.08\nTrailing Percentage (from difference): 3.02%\nSymbol: TM, Quantity: 2.14, Stop Price: 170.08, Limit Price: 169.58\nFirst target price not yet reached for TM, setting stop loss order.\nCurrent Price: $175.38, Target Price 1: $193.78\n\nStock: COP\nCurrent Price: $102.845\nStop Price from get_stop(): $102.98\nTrailing Percentage (from difference): -0.13%\nSymbol: COP, Quantity: 0.55, Stop Price: 102.98, Limit Price: 102.48\nSkipping order for COP because quantity to sell is less than 1.\nFirst target price not yet reached for COP, setting stop loss order.\nCurrent Price: $102.84, Target Price 1: $116.97\n\nStock: EWBC\nCurrent Price: $96.3\nStop Price from get_stop(): $94.4\nTrailing Percentage (from difference): 1.97%\nSecond target price reached for EWBC, setting stop loss order for all at $95.92 with a gain of 16.25%.\nCurrent Price: $96.30, Target Price 2: $90.83, Average Buy Price: $82.84\n\nStock: SSNC\nCurrent Price: $70.585\nStop Price from get_stop(): $68.72\nTrailing Percentage (from difference): 2.64%\nSymbol: SSNC, Quantity: 5.17, Stop Price: 68.72, Limit Price: 68.22\nFirst target price not yet reached for SSNC, setting stop loss order.\nCurrent Price: $70.58, Target Price 1: $80.29\n\nStock: NOW\nCurrent Price: $952.6465\nStop Price from get_stop(): $927.66\nTrailing Percentage (from difference): 2.62%\nSymbol: NOW, Quantity: 0.527, Stop Price: 927.66, Limit Price: 927.16\nSkipping order for NOW because quantity to sell is less than 1.\nFirst target price not yet reached for NOW, setting stop loss order.\nCurrent Price: $952.65, Target Price 1: $994.75\n\nStock: OMAB\nCurrent Price: $67.68\nStop Price from get_stop(): $65.48\nTrailing Percentage (from difference): 3.25%\nSymbol: OMAB, Quantity: 9.91, Stop Price: 65.48, Limit Price: 64.98\nFirst target price not yet reached for OMAB, setting stop loss order.\nCurrent Price: $67.68, Target Price 1: $70.21\n\nStock: XLK\nCurrent Price: $231.02\nStop Price from get_stop(): $226.66\nTrailing Percentage (from difference): 1.89%\nSymbol: XLK, Quantity: 2.84, Stop Price: 226.66, Limit Price: 226.16\nFirst target price not yet reached for XLK, setting stop loss order.\nCurrent Price: $231.02, Target Price 1: $244.56\n\nStock: KB\nCurrent Price: $68.92\nStop Price from get_stop(): $70.84\nTrailing Percentage (from difference): -2.79%\nSecond target price reached for KB, setting stop loss order for all at $69.30 with a gain of 10.04%.\nCurrent Price: $68.92, Target Price 2: $68.67, Average Buy Price: $62.63\n\nStock: WST\nCurrent Price: $308.71\nStop Price from get_stop(): $303.39\nTrailing Percentage (from difference): 1.72%\nSymbol: WST, Quantity: 0.64, Stop Price: 303.39, Limit Price: 302.89\nSkipping order for WST because quantity to sell is less than 1.\nFirst target price not yet reached for WST, setting stop loss order.\nCurrent Price: $308.71, Target Price 1: $326.57\n\nStock: ODFL\nCurrent Price: $198.92\nStop Price from get_stop(): $196.06\nTrailing Percentage (from difference): 1.44%\nSymbol: ODFL, Quantity: 0.92, Stop Price: 196.06, Limit Price: 195.56\nSkipping order for ODFL because quantity to sell is less than 1.\nFirst target price not yet reached for ODFL, setting stop loss order.\nCurrent Price: $198.92, Target Price 1: $216.32\n\nStock: LNW\nCurrent Price: $96.17\nStop Price from get_stop(): $92.98\nTrailing Percentage (from difference): 3.32%\nSymbol: LNW, Quantity: 7.0, Stop Price: 92.98, Limit Price: 92.48\nFirst target price not yet reached for LNW, setting stop loss order.\nCurrent Price: $96.17, Target Price 1: $99.32\n\nStock: IDXX\nCurrent Price: $455.58\nStop Price from get_stop(): $443.44\nTrailing Percentage (from difference): 2.66%\nSymbol: IDXX, Quantity: 0.69, Stop Price: 443.44, Limit Price: 442.94\nSkipping order for IDXX because quantity to sell is less than 1.\nFirst target price not yet reached for IDXX, setting stop loss order.\nCurrent Price: $455.58, Target Price 1: $507.89\n\nStock: POWI\nCurrent Price: $63.74\nStop Price from get_stop(): $62.58\nTrailing Percentage (from difference): 1.82%\nSymbol: POWI, Quantity: 10.28, Stop Price: 62.58, Limit Price: 62.08\nFirst target price not yet reached for POWI, setting stop loss order.\nCurrent Price: $63.74, Target Price 1: $67.66\n\nStock: RMBS\nCurrent Price: $44.25\nStop Price from get_stop(): $43.12\nTrailing Percentage (from difference): 2.55%\nSymbol: RMBS, Quantity: 15.18, Stop Price: 43.12, Limit Price: 42.62\nFirst target price not yet reached for RMBS, setting stop loss order.\nCurrent Price: $44.25, Target Price 1: $45.83\n\nStock: UNF\nCurrent Price: $188.685\nStop Price from get_stop(): $181.88\nTrailing Percentage (from difference): 3.61%\nSymbol: UNF, Quantity: 0.48, Stop Price: 181.88, Limit Price: 181.38\nSkipping order for UNF because quantity to sell is less than 1.\nFirst target price not yet reached for UNF, setting stop loss order.\nCurrent Price: $188.69, Target Price 1: $199.62\n\nStock: MKSI\nCurrent Price: $102.31\nStop Price from get_stop(): $98.36\nTrailing Percentage (from difference): 3.86%\nSymbol: MKSI, Quantity: 0.47, Stop Price: 98.36, Limit Price: 97.86\nSkipping order for MKSI because quantity to sell is less than 1.\nFirst target price not yet reached for MKSI, setting stop loss order.\nCurrent Price: $102.31, Target Price 1: $119.63\n\nStock: PSX\nCurrent Price: $128.225\nStop Price from get_stop(): $125.82\nTrailing Percentage (from difference): 1.88%\nSymbol: PSX, Quantity: 0.97, Stop Price: 125.82, Limit Price: 125.32\nSkipping order for PSX because quantity to sell is less than 1.\nFirst target price not yet reached for PSX, setting stop loss order.\nCurrent Price: $128.22, Target Price 1: $139.55\n\nStock: PNFP\nCurrent Price: $102.14\nStop Price from get_stop(): $99.86\nTrailing Percentage (from difference): 2.23%\nSymbol: PNFP, Quantity: 3.96, Stop Price: 99.86, Limit Price: 99.36\nFirst target price not yet reached for PNFP, setting stop loss order.\nCurrent Price: $102.14, Target Price 1: $104.76\n\nStock: VEEV\nCurrent Price: $213.17\nStop Price from get_stop(): $207.62\nTrailing Percentage (from difference): 2.60%\nSymbol: VEEV, Quantity: 0.38, Stop Price: 207.62, Limit Price: 207.12\nSkipping order for VEEV because quantity to sell is less than 1.\nFirst target price not yet reached for VEEV, setting stop loss order.\nCurrent Price: $213.17, Target Price 1: $219.73\n\nStock: VC\nCurrent Price: $92.84\nStop Price from get_stop(): $92.23\nTrailing Percentage (from difference): 0.66%\nSymbol: VC, Quantity: 7.1, Stop Price: 92.23, Limit Price: 91.73\nFirst target price not yet reached for VC, setting stop loss order.\nCurrent Price: $92.84, Target Price 1: $97.89\n\nStock: WMS\nCurrent Price: $153.22\nStop Price from get_stop(): $149.11\nTrailing Percentage (from difference): 2.68%\nSymbol: WMS, Quantity: 0.54, Stop Price: 149.11, Limit Price: 148.61\nSkipping order for WMS because quantity to sell is less than 1.\nFirst target price not yet reached for WMS, setting stop loss order.\nCurrent Price: $153.22, Target Price 1: $163.54\n\nStock: SQM\nCurrent Price: $41.77\nStop Price from get_stop(): $39.46\nTrailing Percentage (from difference): 5.53%\nSymbol: SQM, Quantity: 16.01, Stop Price: 39.46, Limit Price: 38.96\nFirst target price not yet reached for SQM, setting stop loss order.\nCurrent Price: $41.77, Target Price 1: $43.43\n\nStock: NKE\nCurrent Price: $78.9668\nStop Price from get_stop(): $77.39\nTrailing Percentage (from difference): 2.00%\nSymbol: NKE, Quantity: 0.82, Stop Price: 77.39, Limit Price: 76.89\nSkipping order for NKE because quantity to sell is less than 1.\nFirst target price not yet reached for NKE, setting stop loss order.\nCurrent Price: $78.97, Target Price 1: $86.14\n"}, {"name": "stdout", "output_type": "stream", "text": "\nStock: NTES\nCurrent Price: $80.47\nStop Price from get_stop(): $77.0\nTrailing Percentage (from difference): 4.31%\nSymbol: NTES, Quantity: 2.0, Stop Price: 77.0, Limit Price: 76.5\nFirst target price not yet reached for NTES, setting stop loss order.\nCurrent Price: $80.47, Target Price 1: $83.08\n\nStock: WIX\nCurrent Price: $168.7\nStop Price from get_stop(): $163.2\nTrailing Percentage (from difference): 3.26%\nSymbol: WIX, Quantity: 2.97, Stop Price: 163.2, Limit Price: 162.7\nFirst target price not yet reached for WIX, setting stop loss order.\nCurrent Price: $168.70, Target Price 1: $176.25\n\nStock: VRTX\nCurrent Price: $475.72\nStop Price from get_stop(): $469.68\nTrailing Percentage (from difference): 1.27%\nSymbol: VRTX, Quantity: 1.05, Stop Price: 469.68, Limit Price: 469.18\nFirst target price not yet reached for VRTX, setting stop loss order.\nCurrent Price: $475.72, Target Price 1: $499.73\n\nStock: ICLR\nCurrent Price: $226.75\nStop Price from get_stop(): $218.9\nTrailing Percentage (from difference): 3.46%\nSymbol: ICLR, Quantity: 1.67, Stop Price: 218.89, Limit Price: 218.39\nFirst target price not yet reached for ICLR, setting stop loss order.\nCurrent Price: $226.75, Target Price 1: $313.70\n\nStock: TX\nCurrent Price: $35.6816\nStop Price from get_stop(): $34.28\nTrailing Percentage (from difference): 3.93%\nSymbol: TX, Quantity: 18.58, Stop Price: 34.28, Limit Price: 33.78\nFirst target price not yet reached for TX, setting stop loss order.\nCurrent Price: $35.68, Target Price 1: $37.40\n\nStock: LFUS\nCurrent Price: $258.28\nStop Price from get_stop(): $246.82\nTrailing Percentage (from difference): 4.44%\nSymbol: LFUS, Quantity: 0.98, Stop Price: 246.82, Limit Price: 246.32\nSkipping order for LFUS because quantity to sell is less than 1.\nFirst target price not yet reached for LFUS, setting stop loss order.\nCurrent Price: $258.28, Target Price 1: $270.09\n\nStock: NDSN\nCurrent Price: $251.61\nStop Price from get_stop(): $243.56\nTrailing Percentage (from difference): 3.20%\nSymbol: NDSN, Quantity: 0.97, Stop Price: 243.56, Limit Price: 243.06\nSkipping order for NDSN because quantity to sell is less than 1.\nFirst target price not yet reached for NDSN, setting stop loss order.\nCurrent Price: $251.61, Target Price 1: $271.06\n\nStock: JOE\nCurrent Price: $53.25\nStop Price from get_stop(): $51.71\nTrailing Percentage (from difference): 2.89%\nSymbol: JOE, Quantity: 0.47, Stop Price: 51.71, Limit Price: 51.21\nSkipping order for JOE because quantity to sell is less than 1.\nFirst target price not yet reached for JOE, setting stop loss order.\nCurrent Price: $53.25, Target Price 1: $64.08\n\nStock: MMS\nCurrent Price: $87.875\nStop Price from get_stop(): $85.93\nTrailing Percentage (from difference): 2.21%\nSymbol: MMS, Quantity: 0.43, Stop Price: 85.93, Limit Price: 85.43\nSkipping order for MMS because quantity to sell is less than 1.\nFirst target price not yet reached for MMS, setting stop loss order.\nCurrent Price: $87.88, Target Price 1: $93.62\n\nStock: THO\nCurrent Price: $106.47\nStop Price from get_stop(): $103.68\nTrailing Percentage (from difference): 2.62%\nSymbol: THO, Quantity: 0.69, Stop Price: 103.68, Limit Price: 103.18\nSkipping order for THO because quantity to sell is less than 1.\nFirst target price not yet reached for THO, setting stop loss order.\nCurrent Price: $106.47, Target Price 1: $112.38\n\nStock: VDE\nCurrent Price: $123.81\nStop Price from get_stop(): $123.47\nTrailing Percentage (from difference): 0.27%\nSymbol: VDE, Quantity: 0.15, Stop Price: 123.47, Limit Price: 122.97\nSkipping order for VDE because quantity to sell is less than 1.\nFirst target price not yet reached for VDE, setting stop loss order.\nCurrent Price: $123.81, Target Price 1: $131.73\n\nStock: VEU\nCurrent Price: $60.925\nStop Price from get_stop(): $60.04\nTrailing Percentage (from difference): 1.45%\nSymbol: VEU, Quantity: 0.36, Stop Price: 60.04, Limit Price: 59.54\nSkipping order for VEU because quantity to sell is less than 1.\nFirst target price not yet reached for VEU, setting stop loss order.\nCurrent Price: $60.92, Target Price 1: $65.24\n\nStock: VGK\nCurrent Price: $68.39\nStop Price from get_stop(): $67.36\nTrailing Percentage (from difference): 1.51%\nSymbol: VGK, Quantity: 0.55, Stop Price: 67.36, Limit Price: 66.86\nSkipping order for VGK because quantity to sell is less than 1.\nFirst target price not yet reached for VGK, setting stop loss order.\nCurrent Price: $68.39, Target Price 1: $74.73\n\nStock: TEL\nCurrent Price: $150.04\nStop Price from get_stop(): $145.52\nTrailing Percentage (from difference): 3.01%\nSymbol: TEL, Quantity: 2.64, Stop Price: 145.52, Limit Price: 145.02\nFirst target price not yet reached for TEL, setting stop loss order.\nCurrent Price: $150.04, Target Price 1: $157.17\n\nStock: ACA\nCurrent Price: $95.65\nStop Price from get_stop(): $91.2\nTrailing Percentage (from difference): 4.65%\nSymbol: ACA, Quantity: 0.01, Stop Price: 91.2, Limit Price: 90.7\nSkipping order for ACA because quantity to sell is less than 1.\nFirst target price not yet reached for ACA, setting stop loss order.\nCurrent Price: $95.65, Target Price 1: $99.03\n\nStock: LRCX\nCurrent Price: $76.92\nStop Price from get_stop(): $77.16\nTrailing Percentage (from difference): -0.31%\nSymbol: LRCX, Quantity: 8.35, Stop Price: 77.16, Limit Price: 76.66\nFirst target price not yet reached for LRCX, setting stop loss order.\nCurrent Price: $76.92, Target Price 1: $83.27\n\nStock: VNQ\nCurrent Price: $96.64\nStop Price from get_stop(): $93.5\nTrailing Percentage (from difference): 3.25%\nSymbol: VNQ, Quantity: 6.84, Stop Price: 93.5, Limit Price: 93.0\nFirst target price not yet reached for VNQ, setting stop loss order.\nCurrent Price: $96.64, Target Price 1: $101.75\n\nStock: WFG\nCurrent Price: $95.99\nStop Price from get_stop(): $96.17\nTrailing Percentage (from difference): -0.19%\nSymbol: WFG, Quantity: 6.71, Stop Price: 96.17, Limit Price: 95.67\nFirst target price not yet reached for WFG, setting stop loss order.\nCurrent Price: $95.99, Target Price 1: $103.57\nEnding main loop iteration...\n"}], "source": " \nusername ='liuweiwang0824@gmail.com'\npassword ='Umcqar45&M'\n \nimport random\n\nimport pytz\nfrom datetime import timedelta\nimport math\nimport robin_stocks.robinhood as rh\nimport pandas as pd\nimport requests\nfrom datetime import datetime\nimport time as time_module\nfrom robin_stocks.orders import order_sell_stop_loss\ndef login():\n    rh.login(username, password)\ndef get_stop(stock):# pivotpoints\n        from datetime import datetime as dt\n        import datetime\n        import dateutil\n        today = datetime.datetime.today()\n        delta = dateutil.relativedelta.relativedelta(months=1)\n        end = (today-datetime.timedelta(1)).strftime('%Y-%m-%d')\n        start = (today - delta).strftime('%Y-%m-%d')\n\n        import requests\n        api_key = '86dd63f6b8ae774b061232685b78eb52'\n        from datetime import datetime\n        bs = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/{stock}?from={start}&to={end}&apikey={api_key}').json()['historical']\n       \n        # Print the raw data to check\n        #print(f\"Raw data for {stock}:\")\n       # print(bs)\n       \n        stock = pd.DataFrame(bs)\n        stock =stock[['date','open','high','low','close','volume']]\n        stock = stock.rename(columns = {'date':'Date', 'open':'Open', 'high':'High','low':'Low', 'close':'Close', 'volume':'volume'})\n        stock = stock.set_index('Date')\n        stock= stock.sort_index()\n        last_day = stock.iloc[-1].to_frame().T\n        not_pivots = last_day.columns\n        last_day['center_gravity'] = (last_day['High'] + last_day['Low'] + last_day['Close'])/3\n        last_day['center_gravity']=round(last_day['center_gravity'],2)\n        # Print calculations\n        #print(\"\\nCalculations:\")\n      #  print(f\"Center of Gravity: {last_day['center_gravity'].values[0]}\")\n       \n        last_day['vol_up1'] = 2*last_day['center_gravity'] - last_day['Low']\n        last_day['vol_up1']=round(last_day['vol_up1'],2)\n      #  print(f\"Volatility Up 1: {last_day['vol_up1'].values[0]}\")\n       \n        last_day['vol_down1'] = 2*last_day['center_gravity'] - last_day['High']\n        last_day['vol_down1']=round(last_day['vol_down1'],2)\n       # print(f\"Volatility Down 1: {last_day['vol_down1'].values[0]}\")\n       \n        last_day['vol_up2'] = last_day['center_gravity'] + (last_day['High'] - last_day['Low'])\n        last_day['vol_up2']=round(last_day['vol_up2'],2)\n      #  print(f\"Volatility Up 2: {last_day['vol_up2'].values[0]}\")\n      #  \n        last_day['vol_down2'] = last_day['center_gravity'] - (last_day['High'] - last_day['Low'])\n        last_day['vol_down2']=round(last_day['vol_down2'],2)\n       # print(f\"Volatility Down 2: {last_day['vol_down2'].values[0]}\")\n       \n        last_day['vol_up3'] = last_day['center_gravity'] + 2*(last_day['High'] - last_day['Low'])\n        last_day['vol_up3']=round(last_day['vol_up3'],2)\n        #print(f\"Volatility Up 3: {last_day['vol_up3'].values[0]}\")\n       \n        last_day['vol_down3'] = last_day['center_gravity'] - 2*(last_day['High'] - last_day['Low'])\n        last_day['vol_down3']=round(last_day['vol_down3'],2)\n        #print(f\"Volatility Down 3: {last_day['vol_down3'].values[0]}\")\n       \n        last_day['stop_loss'] = (last_day['vol_down2'] + last_day['vol_down3'])/2\n        last_day['stop_loss']=round(last_day['stop_loss'],2)\n        #print(f\"Initial Stop Loss: {last_day['stop_loss'].values[0]}\")\n       \n        last_day['stop_loss_pct'] = (last_day['Close'] - last_day['stop_loss'])/last_day['Close']*100\n        last_day['stop_loss_pct']=round(last_day['stop_loss_pct'],2)\n       # print(f\"Initial Stop Loss Percentage: {last_day['stop_loss_pct'].values[0]}%\")\n       \n        if last_day['stop_loss_pct'][-1] >3.5:\n            last_day['stop_loss'][-1]= (last_day['vol_down1'][-1] + last_day['Close'][-1])/2\n           # print(f\"Adjusted Stop Loss (because percentage > 3.5%): {last_day['stop_loss'].values[0]}\")\n       \n        return last_day\n\nfrom pandas.tseries.holiday import USFederalHolidayCalendar\nfrom datetime import time as datetime_time\ndef open_market():\n    # Check if today is a weekend or holiday\n    today = datetime.now().date()\n    cal = USFederalHolidayCalendar()\n    holidays = cal.holidays(start=today, end=today)\n   \n    if today.weekday() >= 5 or today in holidays:\n        return False\n\n    # Check if the current time is within trading hours\n    time_now = datetime.now().time()\n    market_open = datetime_time(9,30,0) # 9:30AM\n    market_close = datetime_time(15,59,0) # 3:59PM\n\n    if time_now > market_open and time_now < market_close:\n        return True\n    else:\n        return False\n \ndef get_trailing_stop_percentage(stock):\n#    print(f\"Entering get_trailing_stop_percentage for {stock}...\")\n    stop_price = get_stop(stock)['stop_loss'][0]\n    stop_price=round(stop_price,2)\n    current_price = all_data1['price'][stock]\n    trailing_percentage = (current_price - stop_price) / current_price\n   \n    # Print statements for debugging\n    print(f\"\\nStock: {stock}\")\n    print(f\"Current Price: ${current_price}\")\n    print(f\"Stop Price from get_stop(): ${stop_price}\")\n    print(f\"Trailing Percentage (from difference): {trailing_percentage*100:.2f}%\")\n#    print(f\"Exiting get_trailing_stop_percentage for {stock}...\")\n   \n    return trailing_percentage * 0.2  # Use 20% of the calculated stop percentage\n\ndef cancel_all_orders():\n    open_orders = rh.orders.get_all_open_stock_orders()\n    if not open_orders:  # Check if open_orders is None or empty\n        print(\"No open orders found.\")\n        return\n    for order in open_orders:\n        if order:  # Check if the order is not None\n            try:\n                rh.orders.cancel_stock_order(order['id'])\n                # Wait for a random time between 5 and 10 seconds\n                time_to_sleep1 = random.uniform(5, 10)\n                time_module.sleep(time_to_sleep1)\n            except Exception as e:\n                print(f\"Error canceling order for {order['id']}: {e}\")\n        else:\n            print(\"Found a None order.\")\n\nlogin()\n\nsold_half = set()  # Track stocks that we have sold half of\n\nwhile True:\n    # Check if the market is open\n    if open_market():\n        print(\"Market is open.\")\n\n       \n        cancel_all_orders()\n        my_stocks = rh.build_holdings()\n        df = pd.DataFrame(my_stocks).T\n        df1 = df[['price', 'quantity', 'average_buy_price', 'percent_change']]\n        stock = df1.index.tolist()\n        all_data = pd.DataFrame()\n   \n        for ticker in stock:\n            try:\n                last_day = get_stop(ticker)\n                last_day.index = [ticker]  \n                all_data = pd.concat([all_data, last_day], axis=0)\n            except Exception as e:\n                print(f\"Error processing stock {ticker}: {e}\")\n                if hasattr(e, 'response') and hasattr(e.response, 'text'):\n                    print(e.response.text)\n   \n   \n        all_data = all_data[['stop_loss']]\n        all_data1 = df1.merge(all_data, left_index=True, right_index=True)\n        all_data1['price'] = all_data1['price'].astype(float)\n        all_data1['pct_cha'] = ((all_data1['price'] - all_data1['stop_loss']) / all_data1['price']) * 100\n   \n        x = random.random()\n        y = float((x + 5) / 100)\n        z = float((10 - x) / 100)\n        all_data1['average_buy_price'] = all_data1['average_buy_price'].astype(float)\n        all_data1['target_price1'] = all_data1['average_buy_price'] * (1 + y)\n        all_data1['target_price1']=round(all_data1['target_price1'],2)\n        all_data1['target_price2'] = all_data1['average_buy_price'] * (1 + z)\n        all_data1['target_price2']=round(all_data1['target_price2'],2)\n    #    print(all_data1)\n   \n        print(\"Starting the loop to process each stock for trailing stop...\")\n\n   \n        for s in all_data1.index.tolist():\n            current_price = all_data1['price'][s]\n            average_price = all_data1['average_buy_price'][s]\n            quantity = float(all_data1['quantity'][s])\n            quantity0 = round(quantity, 4)\n            quantity_to_sell=math.floor(quantity)\n   \n            trailing_stop_pct = get_trailing_stop_percentage(s)\n            trailing_stop_price = current_price * (1 - trailing_stop_pct)\n            loss_pct = (current_price - trailing_stop_price) / current_price * 100\n            gain_pct = (current_price - average_price) / average_price * 100\n   \n            if all_data1['target_price1'][s] >= current_price:\n                stopPrice_value = float(all_data1['stop_loss'][s])\n                stopPrice_value = round(stopPrice_value, 2)\n                limitPrice_value = stopPrice_value - 0.5  # \u8bbe\u7f6e\u9650\u4ef7\u4e3a\u201c\u505c\u6b62\u4ef7\u683c\u51cf\u53bb0.5\u201d\n                print(f\"Symbol: {s}, Quantity: {quantity}, Stop Price: {stopPrice_value}, Limit Price: {limitPrice_value}\")\n            \n                if quantity_to_sell >= 1:  # \u6dfb\u52a0\u8fd9\u884c\u68c0\u67e5\n                    try:\n                        response = rh.order(symbol=s, side='sell', stopPrice=str(stopPrice_value), limitPrice=str(limitPrice_value), quantity=str(quantity_to_sell), timeInForce='gtc')                \n                        time_to_sleep = random.uniform(15, 30)\n                        time_module.sleep(time_to_sleep)\n                    except Exception as e:\n                        print(f\"Error executing order for {s}: {e}\")\n                        if hasattr(e, 'response'):\n                            print(\"Error response:\", e.response.text)\n                            if hasattr(e.response, 'json'):\n                                try:\n                                    error_json = e.response.json()\n                                    print(\"Error JSON:\", error_json)\n                                except:\n                                    pass\n                else:\n                    print(f\"Skipping order for {s} because quantity to sell is less than 1.\")  # \u6dfb\u52a0\u8fd9\u884c\u8f93\u51fa\n            \n                print(f\"First target price not yet reached for {s}, setting stop loss order.\")\n                print(f\"Current Price: ${current_price:.2f}, Target Price 1: ${all_data1['target_price1'][s]:.2f}\")\n            \n               \n            elif current_price >= all_data1['target_price1'][s] and s not in sold_half:\n                    if quantity0 >= 2:\n                            quantity1 = math.ceil(quantity0 / 2)  # sell half\n                            quantity1 = math.floor(quantity1)\n                            try:\n                                response = rh.orders.order_sell_market(symbol=s, quantity=quantity1, timeInForce='gfd')\n                                time_to_sleep = random.uniform(15, 30)\n                                time_module.sleep(time_to_sleep)\n                            except Exception as e:\n                                print(f\"Error executing order for {s}: {e}\")\n                                if hasattr(e, 'response'):\n                                    print(\"Error response:\", e.response.text)\n                                    if hasattr(e.response, 'json'):\n                                        try:\n                                            error_json = e.response.json()\n                                            print(\"Error JSON:\", error_json)\n                                        except:\n                                            pass\n                            print(f\"First target price reached for {s}, setting stop loss order for half at ${trailing_stop_price:.2f}.\")\n                            print(f\"Current Price: ${current_price:.2f}, Target Price 1: ${all_data1['target_price1'][s]:.2f}\")\n                            sold_half.add(s)  # Add the stock to the sold half set\n   \n                    else:\n                            try:\n                                response = rh.orders.order_sell_market(symbol=s, quantity=quantity, timeInForce='gfd')\n                                time_to_sleep = random.uniform(15, 30)\n                                time_module.sleep(time_to_sleep)\n                            except Exception as e:\n                                print(f\"Error executing order for {s}: {e}\")\n                                if hasattr(e, 'response'):\n                                    print(\"Error response:\", e.response.text)\n                                    if hasattr(e.response, 'json'):\n                                        try:\n                                            error_json = e.response.json()\n                                            print(\"Error JSON:\", error_json)\n                                        except:\n                                            pass\n                            print(f\"First target price reached for {s}, Current Price: ${current_price:.2f}, with a gain of {gain_pct:.2f}%.\")\n                            print(f\"Due to low initial funding, the entire position in this stock has been sold for profit.\")\n   \n   \n            elif current_price >= all_data1['target_price2'][s]:    \n                if quantity > 1:\n                    sell_amount = math.floor(quantity)\n                    try:\n                        response = rh.order(symbol=s, side='sell', stopPrice=str(trailing_stop_price), limitPrice=str(trailing_stop_price-0.2), quantity=str(sell_amount), timeInForce='gtc')\n                        time_to_sleep = random.uniform(15, 30)\n                        time_module.sleep(time_to_sleep)\n                    except Exception as e:\n                        print(f\"Error executing order for {s}: {e}\")\n                        if hasattr(e, 'response'):\n                            print(\"Error response:\", e.response.text)\n                            if hasattr(e.response, 'json'):\n                                try:\n                                    error_json = e.response.json()\n                                    print(\"Error JSON:\", error_json)\n                                except:\n                                    pass\n                    print(f\"Second target price reached for {s}, setting stop loss order for all at ${trailing_stop_price:.2f} with a gain of {gain_pct:.2f}%.\")\n                    print(f\"Current Price: ${current_price:.2f}, Target Price 2: ${all_data1['target_price2'][s]:.2f}, Average Buy Price: ${average_price:.2f}\")\n   \n                else:\n                    try:\n                        response = rh.orders.order_sell_market(symbol=s, quantity=quantity, timeInForce='gfd')\n                        time_to_sleep = random.uniform(15, 30)\n                        time_module.sleep(time_to_sleep)\n                       \n                    except Exception as e:\n                        print(f\"Error executing order for {s}: {e}\")\n                        if hasattr(e, 'response'):\n                            print(\"Error response:\", e.response.text)\n                            if hasattr(e.response, 'json'):\n                                try:\n                                    error_json = e.response.json()\n                                    print(\"Error JSON:\", error_json)\n                                except:\n                                    pass\n                               \n                    print(f\"Second target price reached for {s}, Current Price: ${current_price:.2f} with a gain of {gain_pct:.2f}%.\")\n                    print(f\"Due to low initial funding, the entire position in this stock has been sold for profit.\")\n   \n   \n   \n   \n            elif current_price <= trailing_stop_price:\n                try:\n                    response = rh.orders.order_sell_market(symbol=s, quantity=quantity, timeInForce='gfd')\n                    time_to_sleep = random.uniform(15, 30)\n\n                    time_module.sleep(time_to_sleep)\n\n                   \n                except Exception as e:\n                    print(f\"Error executing order for {s}: {e}\")\n                    if hasattr(e, 'response'):\n                        print(\"Error response:\", e.response.text)\n                        if hasattr(e.response, 'json'):\n                            try:\n                                error_json = e.response.json()\n                                print(\"Error JSON:\", error_json)\n                            except:\n                                pass\n                           \n                print(f\"Trailing stop would be triggered for {s}, close for all at ${trailing_stop_price:.2f}. \")\n                print(f\"Current Price: ${current_price:.2f}, Trailing Stop Price: ${trailing_stop_price:.2f}\")\n   \n        print(\"Ending main loop iteration...\")\n        time_module.sleep(18000)  # Wait for an hour before checking again\n\n    # else:\n    #     print(\"Market is closed. Waiting for an hour before checking again.\")\n    #     time_module.sleep(7200)  # Wait for an hour before checking again\n           \n    else:\n       print(\"Market is closed or it's past 3:30 PM ET. Waiting until 10:00 AM ET to start again.\")\n       \n       # Calculate the number of seconds to wait until 10:00 AM ET the next day\n       current_datetime_eastern = datetime.now(pytz.timezone('US/Eastern'))\n       next_start_time = current_datetime_eastern.replace(hour=10, minute=0, second=0, microsecond=0) + timedelta(days=1)\n       wait_seconds = (next_start_time - current_datetime_eastern).seconds\n       \n       time_module.sleep(wait_seconds)"}, {"cell_type": "code", "execution_count": null, "id": "b09ee2f6", "metadata": {"trusted": true}, "outputs": [], "source": ""}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9"}}, "nbformat": 4, "nbformat_minor": 5}, "format": "json", "mimetype": null, "size": 118389, "writable": true, "type": "notebook"}