Jump to content

Recommended Posts

Posted

All credit goes to download this github code.

https://github.com/jaungiers/LSTM-Neural-Network-for-Time-Series-Prediction?fbclid=IwAR3XFpiW1TLoh4o1iUXmph8rZT6Hcv6QqZuim3LHFVJCVT_tBAVL7YIU33w

I ran it, it is fully working. I installed python 3.5.4 and all the requirements. The only thing you might have problem with is "pip install tensorflow". I ran mine in windows 7 and I do not have to install Cudas and Cudnn. If you are in windows 10 you might need Cuda 8.0 and Cudnn 5.1(never tested).

Below is a screenshot of the output for sp500:

1262627156_.thumb.png.f7bff5a39e7a43835ee3b3ec26ce16b2.png

Below is the sp500.csv data:

14050571_.thumb.png.b6ab4c8dfc8ba24d2b590cf35d7925be.png

Question:

I want more stock data presented in this format where it got "Date, Open, High, Low, Close, and Volume". I think the Yahoo Stock data has them all, but those skip dates by days I think(I could be wrong, because I am a newb at stock. I never played). If the Yahoo Stock data does include all the trade history from when the company is first launched, do let me know, also let me know if there are other useful stock api to use(I do not want partial stock data I want full stock data), appreciated.

Posted

Regardless of source of data there are stock operations like stock split and stock merge which dramatically change stock price when in the reality they are neutral . Read here:

https://en.m.wikipedia.org/wiki/Stock_split

https://en.m.wikipedia.org/wiki/Reverse_stock_split

Which will completely confuse script or program which doesn't handle them or stock data doesn't contain information about the operation.

E.g. one day stock price is $100 and the next day is $20. Script will interpret it as 80% drop of price when in the reality there was no drop but quantity of shares was 5x multiplied. 

Yet another operation influencing price is dividend. Read here:

https://en.m.wikipedia.org/wiki/Dividend

Posted
On 3/8/2021 at 9:18 PM, Sensei said:

Regardless of source of data there are stock operations like stock split and stock merge which dramatically change stock price when in the reality they are neutral . Read here:

https://en.m.wikipedia.org/wiki/Stock_split

https://en.m.wikipedia.org/wiki/Reverse_stock_split

Which will completely confuse script or program which doesn't handle them or stock data doesn't contain information about the operation.

E.g. one day stock price is $100 and the next day is $20. Script will interpret it as 80% drop of price when in the reality there was no drop but quantity of shares was 5x multiplied. 

Yet another operation influencing price is dividend. Read here:

https://en.m.wikipedia.org/wiki/Dividend

I thought about it. If I do not understand the underlying mechanics of neural network and tensorflow then this program is like a blackbox. I would not know if the stock would rise or fall for a particular company because I do not know how the program operates. So I probably would not use it for now.

Posted

I want to see if I can make money with this app. I am in the middle of testing that out. I wouldn't know if all these people are connecting to my computer and buying the same stock as I do @@.

Posted (edited)
14 hours ago, fredreload said:

I want to see if I can make money with this app. I am in the middle of testing that out. I wouldn't know if all these people are connecting to my computer and buying the same stock as I do @@.

You may make money you may lose money.  The stock market is a chaotic system and as such it is not able to be modelled to the point that making money in the short term is a sure bet.  Good luck.

Edited by Bufofrog
  • 2 weeks later...
Posted (edited)

Hmm, I made the split ratio to 0.65 and followed the model than run the profit for the last ten weeks and generated a profit of 372,000NT. You can check my code below. Do not worry about the huge list, those are just stocks I pick out that are from Taiwan based on a list of stocks from an excel.  Let me know if I have made a mistake in my code.

https://investexcel.net/all-yahoo-finance-stock-tickers/

import os
import os.path
import pandas as pd


def main():
    my_list=["3264.TWO","5489.TWO","3211.TWO","T0502Y.TWO","1589.TW","6210.TWO","1580.TWO","8299.TWO","8076.TWO","6261.TWO","6107.TWO","5906.TW","3452.TWO","2354.TW","8091.TWO","6219.TWO","5426.TWO","5205.TWO","2601.TW","2498.TW","8429.TW","721827.TWO","721663.TWO","6114.TWO","5285.TW","5251.TWO","4502.TWO","3653.TW","3191.TWO","1594.TWO","722527.TWO","72425P.TWO","4763.TW","5701.TWO","3548.TWO","722005.TWO","T2006Y.TWO","721803.TWO","T2003Y.TWO","9136.TW","722025.TWO","722172.TWO","722770.TWO","722528.TWO","4559.TWO","723175.TWO","3322.TWO","721745.TWO","721828.TWO","8418.TWO","722046.TWO","4193.TWO","72480P.TWO","1787.TWO","722604.TWO","6247.TWO","3636.TWO","722690.TWO","5266.TWO","4980.TWO","6540.TWO","4417.TWO","3673.TW","5264.TW","3665.TW","8936.TWO","8411.TW","8406.TWO","6554.TWO","6451.TW","6242.TWO","6238.TWO","5871.TW","4971.TWO","4745.TWO","4157.TWO","4141.TW","3664.TWO","2732.TWO","2637.TW","1590.TW","1525.TW","1256.TWO","722277.TWO","8467.TW","722279.TWO","6125.TWO","722061.TWO","722431.TWO","721910.TWO","5383.TWO","5905.TWO","1565.TWO","6405.TW","5312.TWO","4120.TWO","3363.TWO","3362.TWO","6426.TWO","6233.TWO","8349.TWO","6188.TWO","4999.TW","3042.TW","2904.TW","1307.TW","6271.TW","6277.TW","2884.TW","2330.TW","2888.TW","2317.TW","1452.TW","2486.TW","2303.TW","2062.TW","1773.TW","1513.TW","1466.TW","1314.TW","9935.TW","9904.TW","8103.TW","3617.TW","2891.TW","2886.TW","2488.TW","2475.TW","2454.TW","2409.TW","2392.TW","2382.TW","2355.TW","2325.TW","1503.TW","1323.TW","1102.TW","9926.TW","8110.TW","8039.TW","6505.TW","6176.TW","6115.TW","5434.TW","4906.TW","4736.TWO","3380.TW","3213.TWO","3056.TW","3037.TW","3028.TW","2881.TW","2845.TW","2618.TW","2536.TW","2499.TW","2489.TW","2448.TW","2428.TW","2404.TW","2360.TW","2337.TW","2332.TW","2308.TW","2301.TW","1904.TW","1802.TW","1708.TW","1236.TW","1217.TW","1101.TW","6101.TWO","3218.TWO","4803.TWO","3307.TWO","5347.TWO","2423.TW","8092.TWO","722778.TWO","722331.TWO","5529.TWO","5013.TWO","4953.TWO","4113.TWO","1742.TWO","911622.TW","8222.TW","6259.TWO","721819.TWO","3086.TWO","722760.TWO","3078.TWO","6134.TWO","6170.TWO","8925.TWO","722762.TWO","6118.TWO","3662.TWO","3152.TWO","4922.TWO","3374.TWO","5490.TWO","8942.TWO","4802.TWO","8421.TWO","3171.TWO","5213.TWO","9957.TWO","72346P.TWO","723017.TWO","722968.TWO","722893.TWO","722791.TWO","722732.TWO","722708.TWO","722662.TWO","722586.TWO","722115.TWO","722112.TWO","722054.TWO","721845.TWO","721623.TWO","721622.TWO","721609.TWO","6482.TWO","5508.TWO","5345.TWO","4711.TWO","4533.TWO","3276.TWO","3207.TWO","2235.TWO","72444P.TWO","722665.TWO","T0567Y.TWO","T0508Y.TWO","722731.TWO","722666.TWO","722529.TWO","721949.TWO","722682.TWO","722132.TWO","T0504Y.TWO","721783.TWO","722065.TWO","4703.TWO","721608.TWO","6220.TWO","722895.TWO","721948.TWO","721782.TWO","723273.TWO","723178.TWO","722786.TWO","721798.TWO","72441P.TWO","722593.TWO","721979.TWO","722775.TWO","723274.TWO","722827.TWO","722767.TWO","T0506Y.TWO","721755.TWO","722776.TWO","723038.TWO","6275.TWO","721996.TWO","722885.TWO","721867.TWO","722615.TWO","722788.TWO","722888.TWO","4907.TWO","721869.TWO","722630.TWO","722837.TWO","722934.TWO","722839.TWO","2221.TWO","722494.TWO","722836.TWO","721786.TWO","722561.TWO","722130.TWO","722466.TWO","722021.TWO","2599.TWO","722715.TWO","72353P.TWO","5216.TWO","4734.TWO","722574.TWO","722749.TWO","722944.TWO","722828.TWO","6423.TWO","722842.TWO","722889.TWO","722677.TWO","722942.TWO","722588.TWO","721785.TWO","721946.TWO","722224.TWO","722886.TWO","721884.TWO","9962.TWO","721784.TWO","722589.TWO","72442P.TWO","723275.TWO","722790.TWO","721870.TWO","722225.TWO","723179.TWO","722575.TWO","722743.TWO","721880.TWO","72382P.TWO","722632.TWO","722829.TWO","72473P.TWO","72431P.TWO","721924.TWO","722572.TWO","722970.TWO","721621.TWO","72370P.TWO","721691.TWO","1568.TW","3531.TWO","723077.TWO","722533.TWO","722465.TWO","722711.TWO","722789.TWO","722114.TWO","6124.TWO","2726.TWO","722766.TWO","722531.TWO","722663.TWO","6418.TWO","4430.TWO","722986.TWO","9188.TW","722631.TWO","722709.TWO","8390.TWO","722675.TWO","722053.TWO","722884.TWO","72372P.TWO","721544.TWO","723272.TWO","722113.TWO","722250.TWO","722590.TWO","722710.TWO","721725.TWO","722733.TWO","72443P.TWO","722591.TWO","72499P.TWO","721756.TWO","721670.TWO","72505P.TWO","722240.TWO","4562.TWO","722239.TWO","72310P.TWO","721995.TWO","721883.TWO","5474.TWO","9961.TWO","72478P.TWO","72412P.TWO","4530.TWO","722530.TWO","722787.TWO","72504P.TWO","722177.TWO","722532.TWO","722454.TWO","4102.TWO","721723.TWO","722453.TWO","722519.TWO","722748.TWO","6194.TWO","721818.TWO","721994.TWO","72500P.TWO","722985.TWO","6023.TWO","721669.TWO","72477P.TWO","722576.TWO","721553.TWO","2067.TWO","722614.TWO","8435.TWO","3581.TWO","4958.TW","4544.TWO","3553.TWO","8932.TWO","8176.TWO","4543.TWO","1780.TWO","3628.TWO","6511.TWO","8071.TWO","3236.TWO","8121.TWO","3126.TWO","3492.TWO","5240.TWO","5536.TWO","6403.TWO","8255.TWO","3434.TWO","6455.TWO","5209.TWO","3438.TWO","5491.TWO","3071.TWO","3516.TWO","4142.TW","3260.TWO","8086.TWO","8938.TWO","4160.TWO","5227.TWO","6287.TWO","3564.TWO","1599.TWO","2634.TW","3414.TWO","6507.TWO","4609.TWO","6526.TWO","3615.TWO","1626.TW","3538.TWO","4545.TW","3693.TWO","6174.TWO","8024.TWO","3162.TWO","4553.TWO","4702.TWO","8054.TWO","3627.TWO","4558.TWO","3526.TWO","8478.TWO","6187.TWO","8155.TWO","5386.TWO","5601.TWO","6204.TWO","5272.TWO","8438.TWO","6241.TWO","6411.TWO","3188.TWO","6546.TWO","4760.TWO","5233.TWO","3585.TWO","4188.TWO","3595.TWO","8049.TWO","2241.TWO","6138.TWO","3646.TWO","6276.TWO","3528.TWO","6477.TWO","1259.TWO","6533.TWO","6291.TWO","9110.TW","3587.TWO","911612.TW","5210.TWO","1785.TWO","6560.TWO","8281.TWO","6449.TW","6570.TWO","4908.TWO","3690.TWO","3594.TWO","3217.TWO","6171.TWO","8921.TWO","6432.TWO","4173.TWO","6485.TWO","3169.TWO","1337.TW","3064.TWO","4939.TWO","6240.TWO","6113.TWO","6475.TWO","8038.TWO","5269.TW","5878.TWO","6279.TWO","5274.TWO","4542.TWO","4707.TWO","8082.TWO","4974.TWO","6109.TWO","6465.TWO","6179.TWO","8097.TWO","9106.TW","8074.TWO","6198.TWO","5392.TWO","6103.TWO","4735.TWO","3479.TWO","3597.TWO","3088.TWO","6292.TWO","6530.TWO","6148.TWO","8401.TWO","722883.TWO","6517.TWO","8325.TWO","240602.TWO","3379.TWO","911608.TW","6236.TWO","4726.TWO","4114.TWO","4107.TWO","1784.TWO","4183.TWO","1786.TW","4127.TWO","4154.TWO","4181.TWO","4155.TWO","4911.TWO","4743.TWO","6445.TWO","6458.TWO","4728.TWO","4109.TWO","1258.TWO","3176.TWO","3118.TWO","4161.TWO","8432.TWO","4105.TWO","8933.TWO","1569.TWO","4130.TWO","1783.TW","4740.TWO","4171.TWO","1799.TWO","4195.TWO","3659.TWO","4131.TWO","3566.TWO","4535.TWO","4116.TWO","8433.TWO","4415.TWO","5349.TWO","5863.TWO","3299.TWO","4177.TWO","6472.TWO","1522.TW","6538.TWO","7402.TWO","4556.TWO","8929.TWO","8930.TWO","1816.TWO","5259.TW","4523.TWO","3325.TWO","72369P.TWO","4990.TWO","722440.TWO","72503P.TWO","723063.TWO","722136.TWO","721913.TWO","721709.TWO","722899.TWO","T1612Y.TWO","723268.TWO","72357P.TWO","721857.TWO","72520P.TWO","6217.TWO","3323.TWO","6127.TWO","1103.TW","4123.TWO","5310.TWO","911611.TW","8042.TWO","6022.TWO","5511.TWO","4721.TWO","4205.TWO","1735.TW","1309.TW","8150.TW","1597.TWO","6603.TWO","4546.TWO","6510.TWO","4303.TWO","8923.TWO","5523.TWO","1777.TWO","722810.TWO","6509.TWO","72546P.TWO","8084.TWO","6534.TWO","723040.TWO","722854.TWO","4706.TWO","3345.TWO","2002.TW","5704.TWO","723078.TWO","1586.TWO","4111.TWO","6265.TWO","3631.TWO","4528.TWO","3313.TWO","3310.TWO","3332.TWO","6160.TWO","5864.TWO","5301.TWO","1587.TWO","6527.TWO","4944.TWO","6532.TWO","3377.TWO","3672.TWO","5286.TWO","2231.TW","4744.TWO","6548.TWO","3541.TWO","6566.TWO","5432.TWO","5276.TWO","8437.TWO","3168.TWO","4804.TWO","3521.TWO","5403.TWO","8455.TWO","3657.TWO","3577.TWO","3089.TWO","4716.TWO","9960.TWO","5304.TWO","3671.TWO","5519.TW","2596.TWO","5324.TWO","3252.TWO","6140.TWO","6173.TWO","5609.TWO","1818.TWO","910861.TW","3687.TWO","6180.TWO","911616.TW","4153.TWO","3290.TWO","6523.TWO","T3714Y.TWO","1598.TWO","8351.TWO","6251.TW","4138.TWO","8928.TWO","911613.TWO","8905.TWO","5225.TW","6227.TWO","8409.TWO","3633.TWO","5228.TWO","6425.TWO","3485.TWO","3523.TWO","6462.TWO","3556.TWO","5291.TWO","6211.TWO","3552.TWO","6228.TWO","5317.TWO","8182.TWO","8111.TWO","6245.TWO","4995.TWO","8085.TWO","3297.TWO","8041.TWO","3652.TWO","3128.TWO","5498.TWO","3520.TWO","5381.TWO","6135.TWO","4947.TWO","8289.TWO","6237.TWO","6266.TWO","5395.TWO","4909.TWO","8068.TWO","8171.TWO","T1010Y.TWO","6203.TWO","8487.TWO","3484.TWO","6156.TWO","3268.TWO","3206.TWO","9105.TW","8032.TWO","8287.TWO","3529.TWO","9950.TWO","5299.TWO","8341.TW","1333.TWO","9157.TW","8941.TWO","6126.TWO","3411.TWO","6288.TWO","3707.TWO","3675.TWO","5243.TW","6264.TWO","2926.TWO","00653L.TW","5351.TWO","00652.TW","3567.TWO","00654R.TW","5288.TW","5506.TWO","3647.TWO","6436.TWO","910708.TW","8934.TWO","6496.TWO","2642.TW","2734.TWO","6442.TW","5903.TWO","5015.TWO","8462.TWO","2712.TW","4513.TWO","1516.TW","T1012Y.TWO","T1001Y.TWO","2748.TWO","1722.TW","2061.TWO","3291.TWO","5859.TWO","4961.TWO","722966.TWO","721844.TWO","722258.TWO","4951.TWO","8913.TWO","722903.TWO","722628.TWO","721912.TWO","3554.TWO","722779.TWO","722051.TWO","721923.TWO","1260.TWO","7443.TWO","3483.TWO","3532.TW","5465.TWO","6298.TWO","4510.TWO","2228.TW","4159.TWO","5514.TWO","8906.TWO","4923.TWO","912398.TW","4207.TWO","4413.TWO","5321.TWO","2641.TWO","T0314Y.TWO","T0313Y.TWO","722504.TWO","721843.TWO","722341.TWO","722627.TWO","722977.TWO","723096.TWO","722746.TWO","722063.TWO","722862.TWO","722433.TWO","4429.TWO","4755.TW","722102.TWO","722507.TWO","72364P.TWO","6024.TWO","8383.TWO","721988.TWO","721658.TWO","9802.TW","722734.TWO","722580.TWO","5102.TWO","722745.TWO","722050.TWO","72319P.TWO","721771.TWO","72363P.TWO","T2501Y.TWO","723016.TWO","722505.TWO","1815.TWO","723097.TWO","722861.TWO","722104.TWO","4402.TWO","723013.TWO","722860.TWO","721657.TWO","721616.TWO","722033.TWO","723056.TWO","2724.TWO","8917.TWO","2916.TWO","1312A.TW","5443.TWO","6441.TWO","8908.TWO","3083.TWO","3293.TWO","4991.TWO","6104.TWO","5384.TWO","6456.TW","6479.TWO","6221.TWO","6130.TWO","4952.TW","6026.TWO","3559.TW","3691.TWO","5355.TWO","3610.TWO","5262.TWO","8067.TWO","6151.TWO","4168.TWO","4551.TWO","4187.TWO","913889.TW","4198.TWO","8066.TWO","3428.TWO","6553.TWO","5009.TWO","4551.TW","2636.TWO","5475.TWO","3499.TWO","6481.TWO","910801.TW","3272.TWO","4506.TWO","8472.TWO","4987.TWO","4503.TWO","3178.TWO","6512.TWO","6529.TWO","4730.TWO","3680.TWO","6488.TWO","6218.TWO","3202.TWO","4432.TWO","8354.TWO","6453.TWO","5283.TWO","4175.TWO","8937.TWO","1781.TWO","3658.TWO","1776.TWO","3609.TWO","4139.TWO","3551.TWO","1338.TW","3522.TWO","6190.TWO","T4720Y.TWO","3284.TWO","1268.TWO","5220.TWO","3642.TWO","1788.TWO","6208.TWO","5439.TWO","8446.TWO","722629.TWO","3688.TWO","722493.TWO","722515.TWO","722434.TWO","911626.TW","3706.TW","2730.TWO","8404.TW","6559.TWO","4194.TWO","4406.TWO","4924.TWO","722032.TWO","722863.TWO","722738.TWO","4805.TWO","6487.TWO","6508.TWO","722759.TWO","5328.TWO","722981.TWO","1593.TWO","T1249Y.TWO","722739.TWO","5295.TWO","T1201Y.TWO","722805.TWO","1905.TW","5481.TWO","6163.TWO","5212.TWO","6457.TWO","2897.TWO","8050.TWO","8040.TWO","3372.TWO","3611.TWO","6486.TWO","5438.TWO","3227.TWO","3555.TWO","2035.TWO","910322.TW","1566.TWO","4741.TWO","7421.TWO","3685.TWO","6161.TWO","3147.TWO","722659.TWO","72305P.TWO","722410.TWO","723083.TWO","5820.TWO","4550.TWO","721892.TWO","722500.TWO","721705.TWO","T2005Y.TWO","T2004Y.TWO","722004.TWO","721638.TWO","031261.TW","72498P.TWO","721891.TWO","722409.TWO","722910.TWO","721537.TWO","722268.TWO","3230.TWO","72303P.TWO","722911.TWO","721859.TWO","72496P.TWO","721916.TWO","722619.TWO","722714.TWO","72312P.TWO","722058.TWO","72538P.TWO","6552.TWO","4925.TWO","3629.TWO","4747.TWO","6468.TWO","4190.TW","3543.TWO","5284.TWO","5294.TWO","2063.TWO","2721.TWO","6803.TWO","8107.TWO","722197.TWO","722150.TWO","722193.TWO","722162.TWO","722764.TWO","721769.TWO","722459.TWO","722152.TWO","72371P.TWO","72528P.TWO","722624.TWO","722814.TWO","722427.TWO","72368P.TWO","722929.TWO","722151.TWO","721987.TWO","722235.TWO","72491P.TWO","72335P.TWO","722455.TWO","722432.TWO","721985.TWO","722236.TWO","722984.TWO","72367P.TWO","721842.TWO","722275.TWO","721941.TWO","722156.TWO","72318P.TWO","721686.TWO","72490P.TWO","721595.TWO","723091.TWO","72426P.TWO","722189.TWO","722191.TWO","722696.TWO","72386P.TWO","722270.TWO","721937.TWO","723284.TWO","723286.TWO","72427P.TWO","722931.TWO","031863.TW","722625.TWO","722272.TWO","72385P.TWO","721984.TWO","721983.TWO","722228.TWO","721853.TWO","721655.TWO","72451P.TWO","722460.TWO","722813.TWO","722909.TWO","721840.TWO","722011.TWO","721940.TWO","722962.TWO","722695.TWO","722303.TWO","721935.TWO","722988.TWO","722479.TWO","722100.TWO","722457.TWO","72489P.TWO","722542.TWO","721531.TWO","722716.TWO","721597.TWO","721839.TWO","722274.TWO","722271.TWO","722989.TWO","723090.TWO","722229.TWO","722543.TWO","721855.TWO","722503.TWO","722626.TWO","722752.TWO","72515P.TWO","722157.TWO","722458.TWO","722718.TWO","722234.TWO","721986.TWO","72405P.TWO","721656.TWO","722199.TWO","722987.TWO","723073.TWO","721614.TWO","721767.TWO","722430.TWO","722280.TWO","72428P.TWO","721814.TWO","723092.TWO","721530.TWO","72302P.TWO","722802.TWO","72511P.TWO","722196.TWO","722501.TWO","722502.TWO","72296P.TWO","722983.TWO","722697.TWO","722538.TWO","722694.TWO","722456.TWO","722908.TWO","722960.TWO","722139.TWO","722242.TWO","722195.TWO","723089.TWO","722406.TWO","721770.TWO","723031.TWO","722160.TWO","722539.TWO","722623.TWO","6122.TWO","6516.TWO","3093.TWO","4527.TWO","2639.TWO","5306.TWO","2733.TWO","1757.TWO","1752.TWO","8477.TWO","6431.TW","5206.TWO","8916.TWO","4420.TWO","3287.TWO","2239.TW","8427.TW","1591.TWO","6514.TWO","1262.TW","2738.TWO","2236.TW","6415.TW","5215.TW","4762.TWO","1592.TW","4984.TW","2924.TWO","4557.TW","8426.TWO","8423.TWO","1340.TW","4966.TWO","2115.TW","4935.TW","6541.TWO","4977.TW","2923.TW","8444.TWO","4144.TW","6422.TW","4912.TW","3346.TWO","3068.TWO","5703.TWO","3081.TWO","6207.TWO","8420.TWO","5603.TWO","3588.TW","5410.TWO","5230.TWO","5364.TWO","8127.TWO","8490.TWO","5464.TWO","4972.TWO","1795.TWO","6290.TWO","4401.TWO","2506.TW","4997.TWO","5530.TWO","4979.TWO","5267.TWO","6535.TWO","3527.TWO","721739.TWO","721901.TWO","72550P.TWO","72506P.TWO","722583.TWO","722936.TWO","4541.TWO","722879.TWO","722940.TWO","722412.TWO","722938.TWO","721848.TWO","5902.TWO","722937.TWO","9951.TWO","72439P.TWO","72533P.TWO","722482.TWO","72486P.TWO","722220.TWO","722499.TWO","722581.TWO","72293P.TWO","722780.TWO","722044.TWO","72522P.TWO","721652.TWO","721823.TWO","722568.TWO","723009.TWO","722550.TWO","722824.TWO","723045.TWO","723099.TWO","3563.TWO","722822.TWO","722935.TWO","72547P.TWO","721953.TWO","721778.TWO","3224.TWO","72324P.TWO","721779.TWO","722914.TWO","2064.TWO","721903.TWO","72348P.TWO","721717.TWO","721688.TWO","3294.TWO","721641.TWO","723025.TWO","721957.TWO","721718.TWO","4962.TWO","722980.TWO","722094.TWO","723133.TWO","723006.TWO","723004.TWO","721690.TWO","721902.TWO","722423.TWO","722309.TWO","722480.TWO","721716.TWO","721571.TWO","4419.TWO","3122.TWO","722621.TWO","723005.TWO","2739.TWO","8122.TWO","4128.TWO","3491.TWO","5450.TWO","5538.TW","6244.TWO","4540.TWO","8454.TW","6223.TWO","2740.TWO","3507.TWO","4950.TWO","6407.TWO","5460.TWO","4941.TWO","6547.TWO","5314.TWO","4431.TWO","4712.TWO","4732.TWO","3630.TWO","3558.TWO","6143.TWO","5202.TWO","8147.TWO","911868.TW","8234.TWO","3512.TWO","3317.TWO","3444.TWO","8927.TWO","6542.TWO","6419.TWO","6494.TWO","3066.TWO","6483.TWO","4174.TWO","5907.TW","5011.TWO","2741.TWO","6569.TWO","8044.TWO","8458.TWO","3666.TWO","4166.TWO","3441.TWO","6464.TW","4903.TWO","4933.TWO","4729.TWO","8034.TWO","4129.TWO","723033.TWO","723180.TWO","4554.TWO","8080.TWO","3570.TWO","4916.TW","3097.TWO","3632.TWO","1760.TWO","4965.TWO","5480.TWO","6446.TWO","5211.TWO","6491.TWO","3067.TWO","4180.TWO","6551.TWO","4162.TWO","6452.TW","4191.TWO","8450.TWO","T2520Y.TWO","5248.TWO","6185.TWO","3131.TWO","1570.TWO","5904.TWO","4714.TWO","6105.TWO","6545.TWO","4973.TWO","4529.TWO","6167.TWO","3537.TWO","1813.TWO","8935.TWO","6412.TW","6550.TWO","8109.TWO","3489.TWO","722216.TWO","722217.TWO","723281.TWO","722289.TWO","8053.TWO","721759.TWO","5277.TWO","722307.TWO","722319.TWO","723085.TWO","721893.TWO","8083.TWO","721860.TWO","721747.TWO","722321.TWO","721631.TWO","723280.TWO","6129.TWO","722290.TWO","721932.TWO","721632.TWO","722322.TWO","721593.TWO","722028.TWO","721731.TWO","8924.TWO","721896.TWO","2855.TW","5242.TWO","722680.TWO","3429.TWO","721809.TWO","721757.TWO","721692.TWO","721930.TWO","722317.TWO","722226.TWO","721971.TWO","5238.TWO","8028.TWO","6498.TWO","6489.TWO","5488.TWO","5315.TWO","6568.TWO","2237.TWO","3592.TWO","3373.TWO","3228.TWO","5256.TWO","2743.TWO","5512.TWO","4968.TW","3306.TWO","4121.TWO","6027.TWO","8048.TWO","6186.TWO","8463.TW","5493.TWO","5876.TWO","6195.TWO","5302.TWO","721576.TWO","721802.TWO","722777.TWO","722900.TWO","721698.TWO","722394.TWO","72295P.TWO","72376P.TWO","72446P.TWO","722747.TWO","722871.TWO","723102.TWO","3105.TWO","722667.TWO","722526.TWO","721625.TWO","72320P.TWO","72396P.TWO","3219.TWO","722584.TWO","5425.TWO","722953.TWO","6016.TWO","723086.TWO","2731.TW","722817.TWO","722134.TWO","723278.TWO","723051.TWO","722108.TWO","72468P.TWO","722169.TWO","722522.TWO","722041.TWO","722488.TWO","722263.TWO","722444.TWO","721654.TWO","8410.TWO","722922.TWO","722995.TWO","72337P.TWO","72342P.TWO","721704.TWO","721559.TWO","722448.TWO","723081.TWO","722906.TWO","721915.TWO","6492.TWO","4416.TWO","8485.TWO","8443.TW","4806.TWO","4305.TWO","6506.TWO","8403.TWO","2611.TW","8291.TWO","5455.TWO","5356.TWO","3288.TWO","722640.TWO","722294.TWO","723075.TWO","722783.TWO","912000.TW","722449.TWO","722264.TWO","722099.TWO","721653.TWO","722723.TWO","6435.TWO","722013.TWO","722038.TWO","722120.TWO","722447.TWO","722525.TWO","722785.TWO","722782.TWO","723181.TWO","722875.TWO","721702.TWO","722639.TWO","72352P.TWO","722304.TWO","722679.TWO","722523.TWO","722720.TWO","722097.TWO","722067.TWO","722509.TWO","721754.TWO","721735.TWO","722047.TWO","722486.TWO","722147.TWO","722014.TWO","722947.TWO","722175.TWO","722657.TWO","722218.TWO","722636.TWO","721852.TWO","721700.TWO","T2506Y.TWO","6121.TWO","722951.TWO","3490.TWO","722678.TWO","722991.TWO","721547.TWO","722596.TWO","722721.TWO","721683.TWO","722074.TWO","722820.TWO","031021.TW","722306.TWO","722638.TWO","721826.TWO","72524P.TWO","722471.TWO","722124.TWO","722963.TWO","722876.TWO","722925.TWO","722512.TWO","722418.TWO","721684.TWO","4433.TWO","72316P.TWO","722816.TWO","721761.TWO","723052.TWO","721878.TWO","72397P.TWO","722849.TWO","722118.TWO","722490.TWO","722949.TWO","722992.TWO","721764.TWO","722127.TWO","722489.TWO","721604.TWO","723034.TWO","722149.TWO","722846.TWO","3511.TWO","72445P.TWO","721928.TWO","722176.TWO","721753.TWO","721734.TWO","721821.TWO","722952.TWO","722850.TWO","722125.TWO","721908.TWO","5483.TWO","722305.TWO","721960.TWO","722148.TWO","722773.TWO","723035.TWO","722265.TWO","722446.TWO","72514P.TWO","722844.TWO","721962.TWO","722417.TWO","721605.TWO","722291.TWO","722122.TWO","722145.TWO","721927.TWO","722948.TWO","722656.TWO","721961.TWO","722637.TWO","722598.TWO","721607.TWO","722993.TWO","722511.TWO","721736.TWO","722702.TWO","722173.TWO","72456P.TWO","722098.TWO","721992.TWO","721964.TWO","3466.TWO","6473.TWO","6222.TWO","3259.TWO","3530.TWO","6577.TWO","6111.TWO","5016.TWO","5478.TWO","2643.TWO","6231.TWO","6146.TWO","8431.TWO","5457.TWO","2719.TWO","2002A.TW","8266.TWO","4930.TW","8179.TWO","3360.TWO","2066.TWO","3681.TWO","3390.TWO","2720.TWO","4304.TWO","4547.TWO","5516.TWO","6154.TWO","1819.TWO","6490.TWO","5278.TWO","4921.TWO","3289.TWO","8279.TWO","5309.TWO","6123.TWO","6575.TWO","8099.TWO","6558.TWO","4192.TWO","3402.TWO","3150.TWO","2913.TW","2640.TWO","6467.TWO","722994.TWO","4934.TW","6246.TWO","4555.TW","8496.TWO","722797.TWO","722737.TWO","6020.TWO","723269.TWO","4905.TWO","6609.TWO","722736.TWO","5353.TWO","722742.TWO","5520.TWO","6274.TWO","722832.TWO","6549.TWO","722750.TWO","3357.TWO","3432.TW","6428.TWO","3095.TWO","6021.TWO","6434.TWO","8931.TWO","722795.TWO","4152.TWO","1336.TWO","4186.TWO","3221.TWO","8436.TWO","4169.TWO","3339.TWO","8065.TWO","8064.TWO","6284.TWO","4163.TWO","3623.TWO","4976.TW","3073.TWO","5344.TWO","3184.TWO","3684.TWO","3580.TWO","3303.TWO","4738.TWO","2633.TWO","3540.TWO","6567.TWO","3144.TWO","6199.TWO","6536.TWO","9949.TWO","5468.TWO","6248.TWO","4147.TWO","5271.TWO","5487.TWO","1585.TWO","2929.TW","3388.TWO","6556.TWO","3226.TWO","4536.TW","2745.TWO","6521.TWO","TPCGI.TWO","5348.TWO","2230.TWO","6469.TWO","5604.TWO","3426.TWO","T4706Y.TWO","6443.TW","6493.TWO","8329.TWO","2729.TWO","6150.TWO","2233.TWO","9945.TW","9939.TW","9937.TW","9908.TW","9907.TW","8926.TW","6286.TW","6239.TW","6214.TW","6206.TW","6201.TW","6168.TW","6155.TW","6153.TW","6145.TW","5608.TW","5533.TW","4746.TW","4733.TW","4133.TW","3607.TW","3605.TW","3598.TW","3591.TW","3579.TW","3576.TW","3545.TW","3504.TW","3481.TW","3419.TW","3057.TW","3035.TW","3034.TW","3026.TW","3025.TW","3022.TW","3019.TW","3018.TW","3010.TW","2915.TW","2911.TW","2906.TW","2905.TW","2903.TW","2887.TW","2882.TW","2820.TW","2609.TW","2608.TW","2606.TW","2605.TW","2603.TW","2530.TW","2495.TW","2478.TW","2457.TW","2456.TW","2438.TW","2437.TW","2429.TW","2419.TW","2406.TW","2383.TW","2379.TW","2377.TW","2374.TW","2353.TW","2352.TW","2347.TW","2342.TW","2338.TW","2331.TW","2328.TW","2327.TW","2323.TW","2321.TW","2313.TW","2311.TW","2227.TW","2207.TW","2101.TW","2012.TW","2010.TW","2006.TW","1809.TW","1808.TW","1731.TW","1614.TW","1605.TW","1582.TW","1541.TW","1533.TW","1521.TW","1447.TW","1444.TW","1326.TW","1316.TW","1313.TW","1232.TW","1219.TW","9955.TW","9944.TW","9943.TW","9941.TW","9934.TW","9929.TW","9928.TW","9927.TW","9925.TW","9924.TW","9919.TW","9918.TW","9914.TW","9911.TW","8422.TW","8271.TW","8261.TW","8163.TW","8114.TW","8081.TW","8072.TW","8046.TW","8016.TW","6702.TW","6605.TW","6409.TW","6289.TW","6281.TW","6257.TW","6243.TW","6235.TW","6209.TW","6205.TW","6197.TW","6192.TW","6184.TW","6166.TW","6152.TW","6141.TW","6139.TW","6117.TW","5531.TW","5525.TW","5522.TW","5521.TW","5484.TW","5471.TW","5289.TWO","4994.TW","4960.TW","4956.TW","4938.TW","4904.TW","4526.TW","4164.TW","4108.TW","4106.TW","3701.TW","3698.TW","3694.TW","3682.TW","3679.TW","3669.TW","3622.TW","3584.TW","3583.TW","3573.TW","3557.TW","3550.TW","3533.TW","3519.TW","3515.TW","3501.TW","3454.TW","3443.TW","3406.TW","3383.TW","3356.TW","3296.TW","3231.TW","3189.TW","3149.TW","3130.TW","3094.TW","3090.TW","3058.TW","3052.TW","3046.TW","3045.TW","3044.TW","3032.TW","3031.TW","3008.TW","3003.TW","3002.TW","2912.TW","2908.TW","2890.TW","2885.TW","2852.TW","2849.TW","2847.TW","2832.TW","2816.TW","2812.TW","2707.TW","2706.TW","2701.TW","2617.TW","2547.TW","2545.TW","2543.TW","2542.TW","2535.TW","2534.TW","2528.TW","2514.TW","2511.TW","2504.TW","2493.TW","2492.TW","2485.TW","2483.TW","2477.TW","2468.TW","2467.TW","2466.TW","2462.TW","2461.TW","2455.TW","2451.TW","2449.TW","2444.TW","2443.TW","2442.TW","2441.TW","2431.TW","2426.TW","2424.TW","2420.TW","2413.TW","2412.TW","2402.TW","2401.TW","2397.TW","2395.TW","2393.TW","2390.TW","2388.TW","2385.TW","2371.TW","2369.TW","2368.TW","2365.TW","2364.TW","2363.TW","2362.TW","2361.TW","2359.TW","2357.TW","2356.TW","2329.TW","2324.TW","2305.TW","2302.TW","2201.TW","2105.TW","2103.TW","2034.TW","2029.TW","2025.TW","2023.TW","2022.TW","2017.TW","2015.TW","1909.TW","1907.TW","1903.TW","1810.TW","1789.TW","1737.TW","1734.TW","1725.TW","1724.TW","1720.TW","1717.TW","1714.TW","1712.TW","1711.TW","1707.TW","1701.TW","1617.TW","1612.TW","1611.TW","1609.TW","1603.TW","1583.TW","1560.TW","1537.TW","1535.TW","1530.TW","1529.TW","1527.TW","1526.TW","1519.TW","1514.TW","1507.TW","1506.TW","1475.TW","1463.TW","1460.TW","1459.TW","1457.TW","1455.TW","1454.TW","1443.TW","1441.TW","1439.TW","1438.TW","1436.TW","1423.TW","1417.TW","1402.TW","1339.TW","1325.TW","1319.TW","1315.TW","1310.TW","1303.TW","1301.TW","1234.TW","1227.TW","1220.TW","1216.TW","1215.TW","722585.TWO","2405.TW","3285.TWO","4752.TWO","722095.TWO","1704.TW","2520.TW","721542.TWO","721749.TWO","722040.TWO","72537P.TWO","72552P.TWO","722001.TWO","722003.TWO","72399P.TWO","2434.TW","3354.TWO","722857.TWO","3164.TW","72359P.TWO","722045.TWO","8056.TWO","1608.TW","2851.TW","6269.TW","722547.TWO","8440.TWO","1517.TW","723266.TWO","8491.TWO","722034.TWO","1730.TW","2501.TW","722007.TWO","1762.TW","6499.TWO","3051.TW","723267.TWO","3059.TW","6164.TW","2615.TW","72555P.TWO","6263.TWO","9942.TW","3674.TWO","722582.TWO","723023.TWO","9917.TW","2102.TW","723067.TWO","2453.TW","3625.TWO","2373.TW","910482.TW","1532.TW","4737.TW","9103.TW","6250.TWO","3054.TW","3151.TWO","8284.TWO","1713.TW","1442.TW","2891A.TW","8021.TW","2548.TW","1210.TW","3518.TW","4919.TW","9910.TW","4967.TWO","8131.TW","2027.TW","72330P.TWO","8047.TWO","8088.TWO","1419.TW","6215.TW","2450.TW","8481.TWO","2718.TWO","3505.TWO","3391.TWO","3033.TW","3092.TWO","8464.TW","2312.TW","2028.TW","6234.TWO","6128.TW","3312.TW","2850.TW","3229.TW","6133.TW","2348.TW","8215.TW","1618.TW","5452.TWO","2316.TW","3702.TW","3508.TWO","6116.TW","3349.TWO","722386.TWO","2439.TW","6005.TW","2735.TWO","2206.TW","6429.TWO","3413.TW","722002.TWO","72299P.TWO","3535.TW","722898.TWO","9940.TW","721780.TWO","3038.TW","4104.TW","2471.TW","722438.TWO","3048.TW","2612.TW","1726.TW","722996.TWO","9933.TW","6172.TW","2610.TW","6518.TWO","2901.TW","2727.TW","3318.TWO","1471.TW","72449P.TWO","5222.TWO","722600.TWO","3596.TW","1324.TW","722758.TWO","722467.TWO","4725.TW","72373P.TWO","3474.TW","722187.TWO","1233.TW","2049.TW","72381P.TWO","6504.TW","1736.TW","2436.TW","2414.TW","2736.TWO","5203.TW","6216.TW","3704.TW","1902.TW","1733.TW","3305.TW","72571P.TWO","2376.TW","722918.TWO","4739.TWO","2007.TW","722116.TWO","4532.TW","72331P.TWO","2030.TW","9902.TW","8105.TW","722902.TWO","5706.TW","3494.TW","5305.TW","722184.TWO","2480.TW","1538.TW","1312.TW","2367.TW","722556.TWO","722077.TWO","721742.TWO","2108.TW","6177.TW","2408.TW","2614.TW","6131.TW","3016.TW","3017.TW","6182.TWO","721535.TWO","6572.TWO","723055.TWO","6196.TW","1539.TW","2474.TW","722186.TWO","1231.TW","9905.TW","9931.TW","72314P.TWO","1558.TW","721545.TWO","722439.TWO","3437.TW","2496.TW","5007.TW","2607.TW","4170.TWO","722379.TWO","1110.TW","2838.TW","3014.TW","3049.TW","1446.TW","9906.TW","722834.TWO","4969.TWO","3562.TWO","4134.TWO","6471.TWO","6562.TWO","3689.TWO","3141.TWO","4150.TWO","8277.TWO","1445.TW","3321.TWO","6539.TWO","1814.TWO","3603.TWO","3455.TWO","8115.TWO","4184.TWO","3624.TWO","4197.TWO","722869.TWO","723121.TWO","721951.TWO","8240.TWO","5201.TWO","721610.TWO","8424.TWO","6272.TWO","4949.TWO","4538.TWO","3265.TWO","8077.TWO","5245.TWO","5287.TWO","3138.TWO","3324.TWO","1595.TWO","721906.TWO","5340.TWO","3074.TWO","8415.TWO","5244.TWO","5263.TWO","3163.TWO","721744.TWO","722017.TWO","72542P.TWO","722019.TWO","722751.TWO","721791.TWO","723059.TWO","722957.TWO","72298P.TWO","721999.TWO","722267.TWO","721838.TWO","721613.TWO","722018.TWO","721627.TWO","721976.TWO","722901.TWO","72307P.TWO","722856.TWO","72417P.TWO","722056.TWO","721727.TWO","721662.TWO","722727.TWO","723061.TWO","72471P.TWO","723060.TWO","T1609Y.TWO","72495P.TWO","721628.TWO","721626.TWO","72494P.TWO","72540P.TWO","72509P.TWO","721536.TWO","722043.TWO","722897.TWO","72450P.TWO","723062.TWO","72461P.TWO","72530P.TWO","72553P.TWO","72344P.TWO","72458P.TWO","721811.TWO","72365P.TWO","722919.TWO","72334P.TWO","72487P.TWO","722646.TWO","722042.TWO","722185.TWO","72407P.TWO","722546.TWO","723177.TWO","722545.TWO","722376.TWO","721975.TWO","721837.TWO","722920.TWO","8359.TWO","6416.TWO","8059.TWO","5258.TWO","723048.TWO","72483P.TWO","721887.TWO","T3735Y.TWO","72464P.TWO","722867.TWO","722241.TWO","72379P.TWO","722866.TWO","722577.TWO","72525P.TWO","72355P.TWO","722941.TWO","72423P.TWO","72465P.TWO","721858.TWO","721694.TWO","723095.TWO","T3701Y.TWO","72306P.TWO","722804.TWO","721533.TWO","721943.TWO","722182.TWO","722441.TWO","722973.TWO","722873.TWO","721836.TWO","722374.TWO","723188.TWO","72551P.TWO","722395.TWO","721888.TWO","723012.TWO","72535P.TWO","721944.TWO","722974.TWO","723047.TWO","4946.TWO","5014.TWO","4427.TWO","3637.TWO","722599.TWO","721611.TWO","722689.TWO","722167.TWO","722641.TWO","3430.TWO","722298.TWO","6147.TWO","721693.TWO","6404.TWO","4137.TW","8096.TWO","722595.TWO","72325P.TWO","72484P.TWO","722700.TWO","721849.TWO","722907.TWO","72481P.TWO","722801.TWO","72413P.TWO","722170.TWO","722215.TWO","72482P.TWO","72351P.TWO","722117.TWO","722812.TWO","6401.TWO","6144.TWO","6212.TWO","8358.TWO","8093.TWO","4549.TWO","723069.TWO","722259.TWO","721772.TWO","722904.TWO","722219.TWO","723026.TWO","721922.TWO","721543.TWO","722287.TWO","72429P.TWO","722237.TWO","3413.TWO","4117.TWO","911619.TW","3431.TWO","8069.TWO","8087.TWO","8043.TWO","723283.TWO","722492.TWO","722491.TWO","6015.TWO","4126.TWO","3114.TWO","5398.TWO","3085.TWO","8183.TWO","4172.TWO","3232.TWO","3205.TWO","3644.TWO","6175.TWO","5229.TWO","5255.TWO","722481.TWO","722411.TWO","722939.TWO","723166.TWO","72361P.TWO","722535.TWO","721775.TWO","722105.TWO","723185.TWO","722536.TWO","722262.TWO","721824.TWO","72532P.TWO","721617.TWO","72308P.TWO","722681.TWO","721918.TWO","722692.TWO","721899.TWO","723008.TWO","721527.TWO","72332P.TWO","72517P.TWO","72350P.TWO","721897.TWO","72360P.TWO","721980.TWO","72349P.TWO","722693.TWO","72519P.TWO","721777.TWO","722647.TWO","723103.TWO","72479P.TWO","722882.TWO","72415P.TWO","722283.TWO","721796.TWO","721549.TWO","4151.TWO","721898.TWO","72414P.TWO","722128.TWO","72476P.TWO","721773.TWO","722728.TWO","723066.TWO","722622.TWO","72544P.TWO","72518P.TWO","722691.TWO","722864.TWO","722414.TWO","3663.TWO","722221.TWO","72336P.TWO","721568.TWO","722425.TWO","722978.TWO","722422.TWO","722756.TWO","721952.TWO","722979.TWO","03034P.TW","721674.TWO","721847.TWO","722012.TWO","722171.TWO","722424.TWO","723030.TWO","722261.TWO","721817.TWO","722296.TWO","722300.TWO","723029.TWO","722052.TWO","722060.TWO","722008.TWO","721687.TWO","722059.TWO","721834.TWO","721832.TWO","8197.TWO","4103.TWO","721861.TWO","722744.TWO","721804.TWO","721862.TWO","722180.TWO","721713.TWO","722075.TWO","722905.TWO","722913.TWO","722483.TWO","721970.TWO","722269.TWO","722318.TWO","722227.TWO","721748.TWO","4534.TWO","721972.TWO","721558.TWO","722107.TWO","72374P.TWO","722179.TWO","72388P.TWO","722251.TWO","722385.TWO","722315.TWO","721633.TWO","722076.TWO","72304P.TWO","72333P.TWO","722384.TWO","72395P.TWO","722252.TWO","72300P.TWO","721758.TWO","722912.TWO","721831.TWO","721830.TWO","722316.TWO","723002.TWO","6270.TWO","2928.TWO","6438.TWO","6417.TWO","3465.TWO","8489.TWO","1817.TW","4167.TWO","3115.TWO","8416.TWO","4537.TWO","3546.TWO","6229.TWO","6294.TWO","3117.TWO","1264.TWO","8465.TWO","4135.TWO","8079.TWO","8476.TWO","4136.TWO","3234.TWO","6158.TWO","6169.TWO","5371.TWO","1584.TWO","3498.TWO","5253.TWO","3678.TWO","1304.TW","3601.TWO","4754.TWO","6461.TWO"]

    df = pd.DataFrame(columns=['A','B','C','D','E','F','G','H','I','J','stock'])

    sum_vals=0

    for tick in my_list:

        if os.path.isfile(os.path.join('data', tick+".csv")) is False:
            continue
        else:
            dataframe = pd.read_csv(os.path.join('data', tick+".csv"))
            if dataframe.shape[0]<500:
                continue
            last_date = dataframe['Date'].values[-1]
            if last_date != "2021-03-18":
                continue

        if os.path.isfile(os.path.join('profit', tick+".txt")) is False:
            continue

        with open(os.path.join('profit', tick+".txt")) as f:
            lines = f.readlines()

        vals = lines[0].split(',')

        if len(vals)<10:
            continue

        vals2 = vals[:10]
        vals2.append(tick)

        a_series = pd.Series(vals2, index = df.columns)

        df = df.append(a_series, ignore_index=True)

        sum_vals = sum_vals+len(vals)

        print(vals)
        print(len(vals))

    print(sum_vals)
    df.to_csv(os.path.join('calc', "calc.csv"))

    sorted_df = df.sort_values(by=["A"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcA.csv"))

    sorted_df = df.sort_values(by=["B"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcB.csv"))

    sorted_df = df.sort_values(by=["C"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcC.csv"))

    sorted_df = df.sort_values(by=["D"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcD.csv"))

    sorted_df = df.sort_values(by=["E"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcE.csv"))

    sorted_df = df.sort_values(by=["F"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcF.csv"))

    sorted_df = df.sort_values(by=["G"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcG.csv"))

    sorted_df = df.sort_values(by=["H"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcH.csv"))

    sorted_df = df.sort_values(by=["I"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcI.csv"))

    sorted_df = df.sort_values(by=["J"], ascending=False)
    sorted_df.to_csv(os.path.join('calc', "calcJ.csv"))

if __name__ == '__main__':
    main()
import os
import os.path
import pandas as pd

i=0
sum_stock=0

my_list=["calcA","calcB","calcC","calcD","calcE","calcF","calcG","calcH","calcI","calcJ"]

for l in my_list:
    dataframe = pd.read_csv(os.path.join('calc', l+".csv"))
    stockopt = dataframe["stock"].head(10)
    for stocki in stockopt:
        df = pd.read_csv(os.path.join('data', stocki+".csv"))
        sorted_df = df.sort_values(by=["Date"], ascending=False)
        sum_stock = sum_stock+sorted_df["Open"].iloc[48*i]-sorted_df["Open"].iloc[48*(i+1)]

    i=i+1
print(sum_stock)

 

Edited by fredreload

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.