import pandas as pd
import numpy as np
import os
#from ta import ichimoku
from util import get_data, plot_data

from pandas import DataFrame, Series
from technical_analysis import ichimoku
from datetime import datetime, timedelta,date
import os
import time
import sys
import getopt,argparse


def test_run(stock='000725'):

	duration = 360
	#now=datetime.now()
	today=date.today()
	ndays_ago=today-timedelta(duration)
	#print(str(n)+" days ago:\n"+str(ndays_ago))
	start_date=str(ndays_ago)
	end_date =str(today)


	df = get_data(stock,start_date, end_date)
	plot_data(df,ichimoku(df['close']),title=stock)


def usage():
	print (sys.argv[0] + ' -s stock id')
	

if __name__ == '__main__':
	opts, args = getopt.getopt(sys.argv[1:], "s:")
	stock_list=''
	single_stock=False
	stock_selected="002281"
	for op, value in opts:
		if op == '-s':
			stock_selected = value
		elif op == '-h':
			usage()
			sys.exit()
	
	test_run(stock_selected)
import pandas as pd
import numpy as np
import os
#from ta import ichimoku
from util import get_data, plot_data

from pandas import DataFrame, Series
from technical_analysis import ichimoku
from datetime import datetime, timedelta,date
import os
import time
import sys
import getopt,argparse

MAX_ROLLING = 100
def test_run(stock='000725'):

	duration = 360
	#now=datetime.now()
	today=date.today()
	ndays_ago=today-timedelta(duration+MAX_ROLLING)
	start_date=str(ndays_ago)
	end_date =str(today)


	df = get_data(stock,start_date, end_date)
	plot_data(df[MAX_ROLLING:],ichimoku(df['close'])[MAX_ROLLING:],title=stock)


def usage():
	print (sys.argv[0] + ' -s stock id')
	

if __name__ == '__main__':
	opts, args = getopt.getopt(sys.argv[1:], "s:")
	stock_list=''
	single_stock=False
	stock_selected="002281"
	for op, value in opts:
		if op == '-s':
			stock_selected = value
		elif op == '-h':
			usage()
			sys.exit()
	
	test_run(stock_selected)

Add the missing data for ichimoku with additional data fed
Add the missing data for ichimoku with additional data fed

  import pandas as pd
  import numpy as np
  import os
  #from ta import ichimoku
  from util import get_data, plot_data
  
  from pandas import DataFrame, Series
  from technical_analysis import ichimoku
  from datetime import datetime, timedelta,date
  import os
  import time
  import sys
  import getopt,argparse
  
- 
+ MAX_ROLLING = 100
  def test_run(stock='000725'):
  
  	duration = 360
  	#now=datetime.now()
  	today=date.today()
- 	ndays_ago=today-timedelta(duration)
+ 	ndays_ago=today-timedelta(duration+MAX_ROLLING)
- 	#print(str(n)+" days ago:\n"+str(ndays_ago))
  	start_date=str(ndays_ago)
  	end_date =str(today)
  
  
  	df = get_data(stock,start_date, end_date)
- 	plot_data(df,ichimoku(df['close']),title=stock)
+ 	plot_data(df[MAX_ROLLING:],ichimoku(df['close'])[MAX_ROLLING:],title=stock)
  
  
  def usage():
  	print (sys.argv[0] + ' -s stock id')
  	
  
  if __name__ == '__main__':
  	opts, args = getopt.getopt(sys.argv[1:], "s:")
  	stock_list=''
  	single_stock=False
  	stock_selected="002281"
  	for op, value in opts:
  		if op == '-s':
  			stock_selected = value
  		elif op == '-h':
  			usage()
  			sys.exit()
  	
  	test_run(stock_selected)
+ 
Add the missing data for ichimoku with additional data fed
## Code Before:
import pandas as pd
import numpy as np
import os
#from ta import ichimoku
from util import get_data, plot_data

from pandas import DataFrame, Series
from technical_analysis import ichimoku
from datetime import datetime, timedelta,date
import os
import time
import sys
import getopt,argparse


def test_run(stock='000725'):

	duration = 360
	#now=datetime.now()
	today=date.today()
	ndays_ago=today-timedelta(duration)
	#print(str(n)+" days ago:\n"+str(ndays_ago))
	start_date=str(ndays_ago)
	end_date =str(today)


	df = get_data(stock,start_date, end_date)
	plot_data(df,ichimoku(df['close']),title=stock)


def usage():
	print (sys.argv[0] + ' -s stock id')
	

if __name__ == '__main__':
	opts, args = getopt.getopt(sys.argv[1:], "s:")
	stock_list=''
	single_stock=False
	stock_selected="002281"
	for op, value in opts:
		if op == '-s':
			stock_selected = value
		elif op == '-h':
			usage()
			sys.exit()
	
	test_run(stock_selected)
## Instruction:
Add the missing data for ichimoku with additional data fed
## Code After:
import pandas as pd
import numpy as np
import os
#from ta import ichimoku
from util import get_data, plot_data

from pandas import DataFrame, Series
from technical_analysis import ichimoku
from datetime import datetime, timedelta,date
import os
import time
import sys
import getopt,argparse

MAX_ROLLING = 100
def test_run(stock='000725'):

	duration = 360
	#now=datetime.now()
	today=date.today()
	ndays_ago=today-timedelta(duration+MAX_ROLLING)
	start_date=str(ndays_ago)
	end_date =str(today)


	df = get_data(stock,start_date, end_date)
	plot_data(df[MAX_ROLLING:],ichimoku(df['close'])[MAX_ROLLING:],title=stock)


def usage():
	print (sys.argv[0] + ' -s stock id')
	

if __name__ == '__main__':
	opts, args = getopt.getopt(sys.argv[1:], "s:")
	stock_list=''
	single_stock=False
	stock_selected="002281"
	for op, value in opts:
		if op == '-s':
			stock_selected = value
		elif op == '-h':
			usage()
			sys.exit()
	
	test_run(stock_selected)
