Advertisement
ImDerekD

Jan3rd_247AM lol

Jan 3rd, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.73 KB | None | 0 0
  1. #!/usr/bin/bash python
  2.  
  3. import csv
  4. import datetime
  5. from datetime import datetime
  6. from colorama import Back, Fore, Style
  7. from colorama import init
  8. import numbers
  9. import time
  10. import itertools
  11. from itertools import zip_longest
  12. from time import sleep
  13. with open('/Users/King/Spy_Current.csv', 'r') as csv_file:
  14. csv_reader = csv.reader(csv_file)
  15. header = next(csv_reader)
  16.  
  17.  
  18. ref = [] # Start off w/ empty list
  19. ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
  20. data = [] # Not sure but I could rearrange for liquidity?
  21. Liquidity = float()
  22. found = int(0)
  23. Range = []
  24. Target = []
  25. filled = bool
  26. filled_Price = float()
  27. Range_List = {}
  28. Low_Range_Found = {}
  29. High_Range_Found = {}
  30. ht_filled = bool
  31. hr_filled = bool
  32. lr_filled = bool
  33. lt_filled = bool
  34. lows_found = int()
  35. highs_found = int()
  36. Range_Found = {}
  37. range_ref_String = ('')
  38. dTime = []
  39. printRanges = str()
  40. range_identifier_low = 'Low'
  41. range_identifier_high = 'High'
  42. range_identifier_all = 'All'
  43. All_Range_References = []
  44. All_Referenced_Prices = []
  45. menu_ans = input('What would you like to do? \n [1] Print Liquidity Data | [2] See previous ranges | [3] Test | [4] Show Changes By Date\n')
  46. if menu_ans == '1':
  47. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  48. if menu_ans == '2':
  49. printRanges = input('Which ranges would you like to see?: [High/Low/All]\n')
  50. range_identifier = ''
  51. new_range = bool
  52. t = bool
  53. tLow = bool
  54. tHigh = bool
  55. Target = float()
  56. Range_Dict = {}
  57. TickString = str()
  58. Tick_String = ''
  59. Strength = int()
  60. StartTraceback = {}
  61. day_Count = int()
  62. tList = []
  63. last = float()
  64. LT = float()
  65. HT = float()
  66. last = float()
  67. TrendStrength = ''
  68. Previous = []
  69. allfoundallfilled = {}
  70. lowfilled = float()
  71. highfilled = float()
  72. rangefilled = bool
  73. low_Ranges_Filled = int()
  74. high_Ranges_Filled = int()
  75. high_Targets_Filled = int()
  76. low_Targets_Filled = int()
  77. prevVol = float(1)
  78. prevFlow = float(1)
  79. prevIndexValue = float(1)
  80.  
  81. for row in csv_reader:
  82. # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
  83. ref_Num += 1 # Starting at 0
  84. dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
  85. Time = dTime[-14:]
  86. Open_Price = float(row[1]) # Price Data Dictionary
  87. Close_Price = float(row[2]) # Price Data Dictionary
  88. High_Price = float(row[3]) # Price Data Dictionary
  89. Low_Price = float(row[4]) # Price Data Dictionary
  90. Money_Flow = float(row[6]) # Price Data Dictionary
  91. Vol = row[5] # Price Data Dictionary
  92. f_Vol = float(Vol[:-1]) # Price Data Dictionary
  93. m_Vol = str(Vol[-1:]) # Price Data Dictionary
  94. if m_Vol == "K": # Price Data Dictionary
  95. f_Vol = f_Vol * 1000 # Price Data Dictionary
  96. if m_Vol == "M": # Price Data Dictionary
  97. f_Vol = f_Vol * 1000000
  98. if m_Vol != "K" and m_Vol != "M":
  99. f_Vol = float(row[5]) # Price Data Dictionary
  100. if f_Vol < 1:
  101. M_Price = HLCC
  102. else:
  103. M_Price = round(float(Money_Flow) / f_Vol, 2)
  104. HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
  105. Diff = round(HLCC - M_Price, 2) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  106. MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  107. Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  108. Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  109. Date = str(Time[:5]) # Important
  110. military_time = str(Time[-8:])
  111. criteria = abs(.003*HLCC)
  112. Liq_Tick = int()
  113. Price_Tick = int()
  114.  
  115. allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
  116. Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
  117. '''USING THIS DATA
  118. [0]REFERENCE NUMBER
  119. [1]DATE
  120. [2]MILITARY_TIME
  121. [3]HIGH_PRICE
  122. [4]LOW_PRICE
  123. [5]CLOSE_PRICE
  124. [6]HLCC
  125. [7]M_Price
  126. [8]F_VOL
  127. [9]MONEY_FLOW
  128. [10]MARKETMAKERMOVE 'MMM'
  129. [11]LIQUIDITY
  130. [12]LIQ_CHANGE
  131. '''
  132. if abs(allData[7]-allData[6]) >= criteria:
  133. found +=1
  134. diff = abs(M_Price - Close_Price)
  135. Range_Clause = True
  136. range_identifier_all = 'All'
  137. if Range_Clause == True:
  138. t_price = M_Price
  139. found_Price = HLCC
  140. Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
  141. High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
  142. Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
  143. High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
  144. if M_Price >= found_Price+diff:
  145. range_ref_String = "HIGH TARGET"
  146. tHigh = True
  147. Target = M_Price
  148. range_identifier = 'High'
  149. found_Price = HLCC
  150. range_identifier_all = 'All'
  151. thList = ['HIGH TARGET', High_Target, highfilled]
  152. filled = False
  153. ht_filled = False
  154. hr_filled = False
  155. highs_found += 1
  156. elif M_Price<= found_Price-diff:
  157. range_ref_String = "LOW TARGET"
  158. tLow = True
  159. Target = M_Price
  160. range_identifier = 'Low'
  161. range_identifier_all = 'All'
  162. found_Price = HLCC
  163. tlList = ['LOW TARGET', Low_Target, lowfilled]
  164. filled = False
  165. lt_filled = False
  166. lr_filled = False
  167. lows_found += 1
  168. RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
  169. LRS = '$'+str(Low_Range)
  170. LRT = '$'+str(Low_Target)
  171. HRS = '$'+str(High_Range)
  172. HRT = '$'+str(High_Target)
  173. found_Price_String = '$'+str(found_Price)
  174. RT_Reference = [LRS, LRT, HRS, HRT]
  175. Target_String = '$'+str(Target)
  176. lows = [LRS, LRT]
  177. highs = [HRS, HRT]
  178. range_ref_String = range_ref_String
  179. target_String = range_ref_String+': $'
  180. end_String = 'Price while found: $'+str(Close_Price)
  181.  
  182. if printRanges == range_identifier and range_identifier == range_identifier_low:
  183. Low_Range_Reference = [Date, military_time, range_ref_String, Target_String, end_String]
  184. Low_Range_Found = {'\nData Found':Low_Range_Reference, 'Watch for: $':lows, 'Potential Resistance: ':highs}
  185. Low_Range = Low_Range_Found
  186. for k, v in dict.items(Low_Range):
  187. print(Fore.RED, k, v)
  188.  
  189. if printRanges == range_identifier and range_identifier == range_identifier_high:
  190. High_Range_Reference = [Date, military_time, range_ref_String, end_String]
  191. High_Range_Found = {'\nData Found': High_Range_Reference, 'Watch for: $':highs, 'Potential Support: ':lows}
  192. High_Range = High_Range_Found
  193. for k, v in dict.items(High_Range):
  194. print(Fore.CYAN, k, v)
  195.  
  196. elif printRanges == range_identifier_all and range_identifier_all == range_identifier_all:
  197. Range_Reference = [Date, military_time, Close_Price, range_ref_String, Target_String]
  198. Low_Ranges = [LRS, LRT]
  199. High_Ranges = [HRS, HRT]
  200. Range_Found = {'<-- Reference':Range_Reference, 'Low Ranges':Low_Ranges, 'High Ranges':High_Ranges}
  201. Range_List[ref_Num] = Range_Found
  202. print(Back.BLUE+Fore.WHITE+str(found), str(Range_Found)+Style.RESET_ALL)
  203. '''if Range_Clause == True:
  204. if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  205. print("MARKET MAKER HIGH TARGET")
  206. if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  207. print("MARKET MAKER LOW TARGET")'''
  208.  
  209. else:
  210. Range_Clause = False
  211. tHigh = False
  212. tLow = False
  213.  
  214. if menu_ans == '1' and Liquidity_Data =='y':
  215.  
  216. if Close_Price > Open_Price and Liq_change > 0:
  217. Price_Tick = 1
  218. Liq_Tick = 1
  219. elif Close_Price >= Open_Price and Liq_change < 0:
  220. Price_Tick = 0
  221. Liq_Tick = -1
  222. elif Close_Price <= Open_Price and Liq_change > 0:
  223. Price_Tick = 0
  224. Liq_Tick = -1
  225. elif Close_Price >= Open_Price and Liq_change < 0:
  226. Price_Tick = -1
  227. Liq_Tick = -1
  228. Tick = Liq_Tick + Price_Tick
  229. Strength += Tick
  230.  
  231. if Tick == 2:
  232. Tick_String = Fore.BLUE+Back.GREEN+'STRONG BUYERS'+Style.RESET_ALL+' '+Fore.GREEN+str(Strength)
  233. if Tick == -1 and Price_Tick == 0:
  234. Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+' '+Fore.RED+str(Strength)
  235. if Tick == -2:
  236. Tick_String = Fore.RED+Back.YELLOW+'STRONG SELLERS BUYERS'+Style.RESET_ALL+' '+Fore.WHITE+str(Strength)
  237. if Tick == -1 and Liq_Tick == 0:
  238. Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+' '+Fore.YELLOW+Back.BLUE+str(Strength)
  239. Range_List[ref_Num] = Range_Found
  240.  
  241. if lr_filled == False:
  242. if filled == False:
  243. if range_ref_String == "LOW TARGET" and Low_Price <= Low_Range:
  244. filled_Price = Low_Price
  245. time.sleep(.5)
  246. print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
  247. time.sleep(1)
  248. lr_filled = True
  249. lt_filled = False
  250. lrf = 1
  251. low_Ranges_Filled += lrf
  252. if lt_filled == False and lr_filled == True:
  253. if Close_Price <= Low_Target:
  254. filled_target_price = Close_Price
  255. time.sleep(.5)
  256. print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
  257. time.sleep(1)
  258. lt_filled = True
  259. filled = True
  260. low_Targets_Filled += 1
  261. if hr_filled == False:
  262. if filled == False:
  263. if range_ref_String == "HIGH TARGET" and High_Price >= High_Range:
  264. filled_range_price = High_Price
  265. time.sleep(.5)
  266. print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
  267. time.sleep(1)
  268. hr_filled = True
  269. ht_filled = False
  270. hrf = 1
  271. high_Ranges_Filled += hrf
  272. if ht_filled == False and hr_filled == True:
  273. if Close_Price >= High_Target:
  274. filled_target_price = High_Price
  275. print(Fore.CYAN + "HIGH TARGET FILLED")
  276. time.sleep(1)
  277. ht_filled = True
  278. filled = True
  279. high_Targets_Filled += 1
  280. if Range_Clause == True:
  281. if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  282. if Liq_change > 1000000:
  283. print("MARKET MAKER HIGH TARGET")
  284. if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  285. if Liq_change < 1000000:
  286. print("MARKET MAKER LOW TARGET")
  287.  
  288. Close_Price = Close_Price
  289. if tHigh == True:
  290. t = True
  291. HRS = str(High_Range)
  292. HRT = str(High_Target)
  293. LRS = str(Low_Range)
  294. LRT = str(Low_Target)
  295. print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.GREEN+Back.BLUE+Style.BRIGHT+' NEW HIGH RANGE FOUND:[$'+HRS+']'+' NEW HIGH TARGET FOUND: [$'+HRT+']'+Style.RESET_ALL)
  296. time.sleep(2)
  297. add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
  298. if add_Range_Target == 'y':
  299. with open('/Users/King/Desktop/RangeTargets.csv', 'a') as csv_file:
  300. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, HRT, Money_Flow, f_Vol, LRS, LRT, Liquidity, Liq_change]
  301. wr = csv.writer(csv_file)
  302. wr.writerow(file_PriceList)
  303. else:
  304. t = False
  305. Close_Price = Close_Price
  306. if tLow == True:
  307. t = True
  308. HRS = str(High_Range)
  309. HRT = str(High_Target)
  310. LRS = str(Low_Range)
  311. LRT = str(Low_Target)
  312. Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
  313. print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' NEW LOW RANGE FOUND:[$'+LRS+']'+' NEW LOW TARGET FOUND: [$'+LRT+']'+Style.RESET_ALL)
  314. time.sleep(2)
  315. add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
  316. if add_Range_Target == 'y':
  317. with open('/Users/King/Desktop/RangeTargets.csv', 'a') as csv_file:
  318. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, LRT, Money_Flow, f_Vol, HRS, HRT, Liquidity, Liq_change]
  319. wr = csv.writer(csv_file)
  320. wr.writerow(file_PriceList)
  321. elif Liq_change < -1000000:
  322. print(Fore.YELLOW + '[' + Date + ']', military_time,
  323. Style.RESET_ALL + Fore.CYAN + Back.RED + Style.BRIGHT + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Back.RED + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + '] ' + Style.RESET_ALL + Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + '**SELL SIGNAL**' + Style.RESET_ALL)
  324. time.sleep(1)
  325. else:
  326. t = False
  327. if abs(Liq_change) > 500000:
  328. time.sleep(.005)
  329. print(Fore.CYAN + '[' + Date + ']', military_time,Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.BLUE + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  330. elif Liquidity > 0:
  331. if Liq_change > 0:
  332. time.sleep(.005)
  333. print(Fore.YELLOW + '[' + Date + ']', military_time,
  334. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  335. Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  336. if Liq_change < 0:
  337. time.sleep(.005)
  338. print(Fore.YELLOW + '[' + Date + ']', military_time,
  339. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  340. Liquidity) + Style.RESET_ALL + Fore.RED + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  341. elif Liq_change > 0:
  342. time.sleep(.005)
  343. print(Fore.YELLOW + '[' + Date + ']', military_time,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  344. elif Liq_change < 0:
  345. time.sleep(.005)
  346. print(Fore.YELLOW + '[' + Date + ']', military_time,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.CYAN,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE+'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  347. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * (Money_Flow / prevFlow), 3)
  348. runningValueIndex = round(MIV_Index+prevIndexValue, 3)
  349. prevFlow = Money_Flow
  350. prevVol = f_Vol
  351. prevIndexValue = MIV_Index
  352. MIV_Index_String = str(MIV_Index)
  353. runningValueIndex_String = str(runningValueIndex)
  354. if abs(MIV_Index) > .25:
  355. if MIV_Index > .25:
  356. MIV_Index_String = str(round(MIV_Index, 2))
  357. print(Fore.BLACK+Back.WHITE+Style.BRIGHT+'MIV_Index: '+Style.RESET_ALL+Fore.BLACK+Back.WHITE+'[+'+MIV_Index_String+'%]'+Style.RESET_ALL+Fore.BLACK+Back.WHITE+Style.BRIGHT+'Running Value: '+Style.RESET_ALL+Fore.BLACK+Back.WHITE+'[+'+runningValueIndex_String+'%]'+Style.RESET_ALL)
  358. elif MIV_Index < -.25:
  359. MIV_Index_String = str(round(MIV_Index, 2))
  360. print(Fore.RED+Back.YELLOW+Style.BRIGHT+'MIV_Index: '+MIV_Index_String, '%', 'Running Value: ', runningValueIndex_String+'%'+Style.RESET_ALL)
  361. else:
  362. if runningValueIndex > 0 and MIV_Index > 0:
  363. print(' '+Fore.BLACK+Back.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
  364. if MIV_Index < 0 and runningValueIndex > 0:
  365. print(' '+Fore.RED+Back.YELLOW+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
  366. if MIV_Index > 0 and runningValueIndex < 0:
  367. print(' '+Fore.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+Back.YELLOW+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)
  368. if MIV_Index < 0 and runningValueIndex < 0:
  369. print(' '+Fore.RED+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)
  370.  
  371. '''else:
  372. runningValueIndex += MIV_Index
  373. runningValueIndex_String = str(round(runningValueIndex, 2))
  374. if runningValueIndex > 0:
  375. print(Fore.GREEN+'MIV_Index: '+runningValueIndex_String, '%')
  376. else:
  377. runningValueIndex_String = str(round(runningValueIndex, 2))
  378. print(Fore.RED+'MIV_Index: '+runningValueIndex_String, '%')'''
  379.  
  380.  
  381.  
  382. '''if menu_ans == '1' and Liquidity_Data == 'list':
  383. print(Fore.CYAN + 'REF#:', ref_Num)
  384. time.sleep(.05)
  385. print(Fore.WHITE + Time)
  386. time.sleep(.05)
  387. print("Last:", "$" + str(Close_Price))
  388. time.sleep(.05)
  389. print("HLCC:", "$" + str(HLCC))
  390. time.sleep(.05)
  391. print("Money Price: ", "$" + str(round(M_Price, 2)))
  392. time.sleep(.05)
  393. print('Price Diff: ' + '$' + str(Diff))
  394. time.sleep(.05)
  395. if f_Vol > 1000000:
  396. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  397. else:
  398. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  399. time.sleep(.05)
  400. if Money_Flow > 350000000:
  401. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  402. else:
  403. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  404. time.sleep(.05)
  405. if Liq_change < 0:
  406. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  407. else:
  408. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  409. time.sleep(.05)
  410. if Liquidity < 0:
  411. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  412. else:
  413. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  414. time.sleep(.1)'''
  415.  
  416. if menu_ans == '3':
  417. Days = ref_Num // 390
  418. Hours = float(ref_Num / 60)
  419. HoursLeft = float(ref_Num / 390 - Days) / 60
  420. Minutes = ref_Num
  421. MinutesLeft = HoursLeft * 100
  422. print('Total Minutes recorded: ',ref_Num)
  423. print('Total Days recorded ', Days,'Days', str(round(HoursLeft, 2)), 'Hours', str(round(MinutesLeft, 2)), 'Minutes')
  424. testans = input('Would you like to see other found ranges?: [y/n]')
  425. if testans == 'y':
  426. with open('/Users/King/Desktop/RangeTargets.csv', 'r') as csv_file:
  427. csv_reader = csv.reader(csv_file)
  428. for row in csv_reader:
  429. Date = row[0]
  430. Time = row[1]
  431. range_ref_String = row[2]
  432. Close_Price = float(row[3])
  433. M_Price = float(row[4])
  434. TargetPrice = row[5]
  435. Money_Flow = float(row[6])
  436. f_Vol = float(row[7])
  437. OppRange = row[8]
  438. OppTarget = row[9]
  439. list = [Date, Time, range_ref_String]
  440. Targets = [M_Price, TargetPrice]
  441. oppositePrices = [OppRange, OppTarget]
  442. listlist = [TargetPrice, OppRange, OppTarget]
  443. dict = {'Info':list, 'Targets: ':Targets, 'Found price: ':Close_Price, 'Opposite Ranges/Targets':oppositePrices}
  444. print(dict)
  445. if menu_ans == '4':
  446. print('Low Targets Found: ', lows_found)
  447. shortAccuracy = low_Ranges_Filled / lows_found
  448. print('Low Targets Met: ', low_Ranges_Filled, '[Accuracy: ', shortAccuracy, '%')
  449. print('High Targets Found: ', highs_found)
  450. longAccuracy = high_Ranges_Filled / highs_found
  451. print('Long Targets Met: ', high_Ranges_Filled, '[Accuracy: ', longAccuracy, '%')
  452.  
  453. print(Fore.CYAN + 'REF#:', ref_Num)
  454. time.sleep(.25)
  455. print(Fore.WHITE + Time)
  456. time.sleep(.25)
  457. print("Last:", "$" + str(Close_Price))
  458. time.sleep(.25)
  459. print("HLCC:", "$" + str(HLCC))
  460. time.sleep(.25)
  461. print("Money Price: ", "$" + str(round(M_Price, 2)))
  462. time.sleep(.25)
  463. print('Price Diff: ' + '$' + str(Diff))
  464. time.sleep(.25)
  465. if f_Vol > 1000000:
  466. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  467. else:
  468. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  469. time.sleep(.25)
  470. if Money_Flow > 350000000:
  471. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  472. else:
  473. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  474. time.sleep(.25)
  475. if Liq_change < 0:
  476. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  477. else:
  478. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  479. time.sleep(.25)
  480. if Liquidity < 0:
  481. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  482. else:
  483. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  484. time.sleep(.25)
  485. percent_Strength = round(Strength / ref_Num, 4)
  486. if percent_Strength >= -.68:
  487. percent_Strength_String = Fore.WHITE+'Current Strength: '+str(percent_Strength)+'%'
  488. else:
  489. percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'
  490. new_Strength = 100-(100*(Strength/ref_Num-(-.286)/(Strength/ref_Num-(-.9333))))
  491. if new_Strength > .70:
  492. new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  493. else:
  494. new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  495. print(percent_Strength_String)
  496. print(new_Strength_String)
  497. high_range_Accuracy = high_Ranges_Filled / highs_found
  498. print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled, str(high_Ranges_Filled/highs_found),'%')
  499. print(found)
  500.  
  501. '''if found >0:
  502. tList = tList
  503. if tList[1] == 'High':
  504. print(Fore.GREEN+'LAST RANGE FOUND: [$' + str(Low_Range)+']','[$' + str(High_Range)+']', ' [' + range_ref_String + ': $' + str(Target)+']'+Style.RESET_ALL)
  505. print(Fore.GREEN+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '[$' + str(High_Target)+']'+Style.RESET_ALL)
  506. print(Fore.GREEN+'Found price: [$' + found_price + ']', 'Target implies a move of [' + implied_move + '%]'+'from current price ['+str(Close_Price)+']'+Style.RESET_ALL)
  507. else:
  508. tList = tList
  509. if tList[1] == 'Low':
  510. print(Fore.RED+'LAST RANGE FOUND: [$' + str(Low_Range)+']','$' + str(High_Range) + ' [' + range_ref_String + ': $' + str(Target)+Style.RESET_ALL)
  511. print(Fore.RED+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '$' + str(High_Target)+Style.RESET_ALL)
  512. print(Fore.RED+'Found price: [$' + (found_price) + ']', 'Target implies a move of [' + implied_move + '%]' + 'from current price [' + str(Close_Price) + ']'+Style.RESET_ALL)'''
  513.  
  514. '''input = input('Would you like to see other found ranges?: [y/n]')
  515. if input == 'y':
  516. with open('/Users/King/Desktop/RangeTargets.csv' 'r') as csv_file:
  517. csv_reader = csv.reader(csv_file)
  518. for row in csv_file:
  519. row[0] = Date
  520. row[1] = Time
  521. row[2] = range_ref_String
  522. row[3] = Close_Price
  523. row[4] = M_Price
  524. row[5] = TargetPrice
  525. print('\nLow Ranges/Targets Found|Filled: ', lows_found, '| ', low_Ranges_Filled, str(round(low_range_Accuracy, 2)), '%')
  526. low_range_Accuracy = low_Ranges_Filled / lows_found
  527.  
  528. row[6] = Money_Flow
  529. row[7] = f_Vol
  530. row[8] = OppRange
  531. row[9] = OppTarget'''
  532.  
  533. '''if abs(Liq_change) > 500000:
  534. time.sleep(.005)
  535. print(Fore.CYAN+'['+Date+']',military_time,Fore.CYAN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.YELLOW+Back.BLUE+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
  536. else if Liquidity > 0:
  537. if Liq_change > 0:
  538. time.sleep(.005)
  539. print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Fore.GREEN+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
  540. if Liq_change < 0:
  541. time.sleep(.005)
  542. print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.RED+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
  543. else if Liq_change > 0:
  544. time.sleep(.005)
  545. print(Fore.YELLOW+'['+Date+']', military_time,Fore.BLUE+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN,' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
  546. else if Liq_change < 0:
  547. time.sleep(.005)
  548. print(Fore.RED+'['+Date+']', military_time,Fore.BLUE+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN,' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement