[Tutor] if you're interested in the code thus far...
Clayton Kirkwood
crk at godblessthe.us
Sun Oct 26 00:46:30 CEST 2014
__author__ = 'SYSTEM'
import string
#Pricing Dividends
raw_table = ('''
a: Ask y: Dividend Yield
b: Bid d: Dividend per Share
b2: Ask (Realtime) r1: Dividend Pay Date
b3: Bid (Realtime) q: Ex-Dividend Date
p: Previous Close
o: Open
Date
c1: Change d1: Last Trade Date
c: Change & Percent Change d2: Trade Date
c6: Change (Realtime) t1: Last Trade Time
k2: Change Percent (Realtime)
p2: Change in Percent
Averages
c8: After Hours Change (Realtime) m5: Change From 200 Day Moving
Average
c3: Commission m6: Percent Change From 200 Day Moving Average
g: Day?s Low m7: Change From 50 Day Moving Average
h: Day?s High m8: Percent Change From 50 Day Moving Average
k1: Last Trade (Realtime) With Time m3: 50 Day Moving Average
l: Last Trade (With Time) m4: 200 Day Moving Average
l1: Last Trade (Price Only)
t8: 1 yr Target Price
Misc
w1: Day?s Value Change g1: Holdings Gain Percent
w4: Day?s Value Change (Realtime) g3: Annualized Gain
p1: Price Paid g4: Holdings Gain
m: Day?s Range g5: Holdings Gain Percent (Realtime)
m2: Day?s Range (Realtime) g6: Holdings Gain (Realtime)
52 Week Pricing Symbol Info
k: 52 Week High v: More Info
j: 52 week Low j1: Market Capitalization
j5: Change From 52 Week Low j3: Market Cap (Realtime)
k4: Change From 52 week High f6: Float Shares
j6: Percent Change From 52 week Low n: Name
k5: Percent Change From 52 week High n4: Notes
w: 52 week Range s: Symbol
s1: Shares Owned
x: Stock Exchange
j2: Shares Outstanding
Volume
v: Volume
a5: Ask Size
b6: Bid Size Misc
k3: Last Trade Size t7: Ticker Trend
a2: Average Daily Volume t6: Trade Links
i5: Order Book (Realtime)
Ratios l2: High Limit
e: Earnings per Share l3: Low Limit
e7: EPS Estimate Current Year v1: Holdings Value
e8: EPS Estimate Next Year v7: Holdings Value (Realtime)
e9: EPS Estimate Next Quarter s6 Revenue
b4: Book Value
j4: EBITDA
p5: Price / Sales
p6: Price / Book
r: P/E Ratio
r2: P/E Ratio (Realtime)
r5: PEG Ratio
r6: Price / EPS Estimate Current Year
r7: Price / EPS Estimate Next Year
s7: Short Ratio
''')
import re, string
col_position, code, description = 0, [], []
key_name = raw_table.replace('\t','\n')
for each_line in key_name.splitlines():
if ':' in each_line:
c, d = each_line.split(':')
code.append(c)
description.append(d.strip())
print( col_position, code[col_position], description[col_position])
col_position += 1
output_line_len = 120
current_output_pos = index = 0
description_output_string = code_output_string = ''
for description_position, code_position in zip(description, code):
#for description_position in description:
# code_position = code[index]
description_position_len = len(description_position)
current_output_pos += description_position_len
# index += 1
if current_output_pos >= output_line_len:
print(description_output_string)
print(code_output_string)
code_output_string=description_output_string=''
current_output_pos=-1 #start new line
description_output_string += '{:^}|'.format(description_position)
code_output_string+='{0:^{1}}|'.format(code_position,
description_position_len)
current_output_pos+=1 #takes care of '|' at end of string
and a subset of output:
Ask|Dividend Yield|Bid|Dividend per Share|Ask (Realtime)|Dividend Pay
Date|Bid (Realtime)|Ex-Dividend Date|
a | y | b | d | b2 | r1 |
b3 | q |
Previous Close|Open|Change|Last Trade Date|Change & Percent Change|Trade
Date|Change (Realtime)|Last Trade Time|
p | o | c1 | d1 | c | d2
| c6 | t1 |
Change Percent (Realtime)|Change in Percent|After Hours Change
(Realtime)|Change From 200 Day Moving Average|Commission|
k2 | p2 | c8 |
m5 | c3 |
P
Spacing not correct on above output obviously!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141025/194467df/attachment-0001.html>
More information about the Tutor
mailing list