{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# Data Time Series Model for Japanese Stock Ranking Program\n# Created By: Yolanda M. Price\n# Date Completed: July 4, 2022\n\n# This model will provide a ranking status of each stock name based on overall ranking \n# for the year 2022 in terms of market value and currency depreciation rate \nimport numpy as np \nimport pandas as pd \nimport jpx_tokyo_market_prediction as JPX_StockData\nenv = jpx_tokyo_market_prediction.make_env()   # initialize the environment\niter_test = env.iter_test()    # an iterator which loops over the test files\nfor (prices, options, financials, trades, secondary_prices, sample_prediction) in iter_test:\n    sample_prediction_df['Rank'] = np.arange(len(sample_prediction))  # make your predictions here\n    env.predict(sample_prediction_df)   # register your predictions\n    print(sample_prediction_df['Rank'])\n    \nt = Daytrade_close\nk = stock_data\nr = stock_changeRate\nC1 = Day_close1\nC2 = Day_close2\n\ndef Stock_RankCalc(r, k, t, C1, C2):\n    r(k,t) = (C2*(k,t+2) - C1*(k,t+1)) / C1*(k,t+1)\n    return r(k,t)\n\n       if sample_prediction_df >= 1500:\n            Stock_RankCalc()\n            print(\"Top 200 stocks for 2022: \")\n        \n        elif sample_prediction_df <= 1500:\n               Stock_RankCalc()\n                print(\"Bottom 200 stocks for 2022: \") \n    \n        else:\n            print(\"Stock rank is unavailable\")\n        \n            return\n\nr = stock_ChangeRate\nt = Daytrade_close\nline_1 = linear_wt1\nline_2 = linear_wt2\nline_average = (line_2 - line_1) / 2\n\n def Sum_up(r,t,line_average) \n    Sum_up = (r * line_average) + 1 / average(line_average)\n     return Sum_up\n    \n    \n     def Sum_down(r,t, line_average)\n       Sum_down = (r * line_average) - 1 / average(line_average)\n       return Sum_down\n\n        \nR_daily_1 = Sum_Up() - Sum_down()     # Section of code will compute the expected daily spread return of \nR_daily_2 = Sum_Up() - Sum_down()     # each stock ranked in both the bottom 200 and the top 200\n\nscore = average((R_daily_1) - (R_daily_2)) / stdev((R_daily_1) - (R_daily_2)) \n\n\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-04T22:57:53.482855Z","iopub.execute_input":"2022-07-04T22:57:53.483538Z","iopub.status.idle":"2022-07-04T22:57:53.499072Z","shell.execute_reply.started":"2022-07-04T22:57:53.483491Z","shell.execute_reply":"2022-07-04T22:57:53.496972Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}