Advertisement
ImDerekD

FixinTime_03_03_9:05

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