Advertisement
ImDerekD

MenuOpt3_RangeFile_CprintColors

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