root/trac/hacks/marketplugin/0.9/TODO

Revision 117 (checked in by stevegt, 6 years ago)

checkpoint after mss tutorial, before moving order validity checks until after order entry into db

Line 
1 x fix hdf paths
2 x cmd 'wiki.SandBox.3' shows order book
3 x trader acct setup
4 x specialist env setup
5 x cmd 'wiki.SandBox' to show basket -- use wiki IRequestHandler interface
6 x basket match split into component legs
7 x wiki specialist code needs to be marketmaker so traders can buy/sell baskets
8     ...do this by overriding quote(), doing transactions to ensure that
9         specialist has at least 500 contracts at bid and ask at all times
10 x test buying/selling baskets
11 x WIP
12 x rename 'cash' to 'available'
13 x rename ISpecialist to ICommandInterpreter
14 x IWikiModel api patch
15 x reporting interpreter
16 x portfolio interpreter
17 x clean up Mock in test_wiki, using IWikiModel api
18 x splits -- use wiki change listener
19 x housekeeping code in post_cmd()
20 x make it possible to place orders via html form
21 x basket sliders
22 x cmd_batch
23 x finish Response class
24 x rework db classes to inherit from dict
25 x move all hdf population and template code into web_ui, just return
26 x     Response objects from cmd_*
27 x fix __iter__ everywhere so it only returns keys
28 x get rid of intf parm
29 x ensure transactions can span cursor create/delete
30 x only get_db_cnx in ui
31 x remove all commits; only commit or rollback in ui
32 x use top-level market.cs to select templates based on namespace
33   x each template refers to verb to select content
34 x interleave wiki.* into market.basket.*
35 x add grants to housekeeping code
36 x base seed on number of issued baskets, then use e.g.
37   WikiSplitter.wiki_page_*() to ensure points issued = traders * pages
38 x rename report to portfolio
39 x fix URLs
40 x (green, yellow, red) message box
41 x don't manipulate market.info etc. directly -- write/use Response.info()
42 x fix order flow
43 x rename wiki.cs to market/wiki-override.cs; use IRequestPostProcessor
44 x what to do about wiki.cs? -- override it; we don't disable wiki
45   x component, but instead intervene via IWikiWorkflowController and
46   x overridden wiki.cs
47 x test/fix order cancellation via web
48 x test grants
49 x logging
50 x "publish" button on bottom of wiki page, using IRequestPostProcessor
51 x write shellauth plugin
52 x publish: new high needs to stay locked, not be normalized
53 x NonPublic
54 x upgrade t7a trac sites
55 x install @ t7a
56
57 x wiki.cs ctxtnav:
58   x move ctxtnav into its own template, include in wiki_override.cs
59   x page, book, portfolio links
60   x don't disable links when on target page; handy for reload
61   x current balance
62   x fix portfolio page
63 x fix page creation
64 x write mq.Bus
65 x write test_mq
66 x create Controller; it creates bus, db, and ctx; ctl.run_cmd() returns
67   entire res tree
68 x have res._set publish to bus
69 x make url RESTful
70 x write tests.util.run_ui
71 x rework web_ui to be a messaging endpoint
72 x make get_default_version also look at bid and ask
73 x use tracd to test on laptop
74
75
76 - rename mq to pyqle
77 - create message table
78 - move bus into standalone daemon
79 - move order matching etc into standalone daemon(s)
80
81 - fix publish button
82
83
84 - fix whatever global is breaking re-used code, then set
85   MaxRequestsPerChild back to 0
86
87
88 - primary goal; break entire app up into lots of little modules which
89   communicate via message bus; make entire app a messaging endpoint by
90   providing a messaging api to *_ui; keep complexity out of core, move
91   it to edges ("move conditionals to edges")
92
93
94
95 - deprecate res_*
96 - deprecate Command.res()
97
98 - follow buy order through to see how well the following would work...
99
100 - order db, matching, etc. needs to be moved to backend market server;
101   just use fe servers for content.
102 - fqdn reverse and prepend to all non-currency symbols going into
103   market server, strip on the way out
104 - require registry of currency with market server, rights to use
105 - 'Market' link takes you to market server
106 - switch between local and remote market via config url
107 - comms:
108     - just use xmlrpc to ship Msg to market server
109     - or hold a TCP connection open so messages can flow
110       bidirectionally
111 - webkdc to auth user
112 - test backend as remote daemon; use setUp and tearDown to stop and
113   start
114 - use Shibboleth to authorize frontend server someday
115
116 - migrate ILedger code to IMessageBusSubscriber, replace ILedger with
117   bus client code
118
119 - write REST_ui, where last component of URL == path on message bus
120 - Use bus reader implementing REST client to talk to remote ledger
121      
122 - deprecate run_cmd
123
124 - find and deprecate all references to res.* (about 11):
125     svngrep 'res[\.\[]' | grep -v test_wiki | egrep '[(=].*res[\.\[]' 
126
127 - shut off res storage in res._set
128 - NOT have res subscribe to bus and accumulate data
129 - find and deprecate all assignments to res.* (about 100):
130     svngrep 'res[\.\[]' | egrep 'res[\.\[].*='
131 - add a deprecation message to res.__getitem__
132 - delete most of res
133
134 - ...either way, always send complete data structures to res.*
135   groups; avoid having to deal with indexes or dict keys in msg attr;
136   this is already the case; Response.append is only used by Response
137
138    
139 - use bus to propagate messages
140 - rewrite res.info, warning, error to send to bus rather than store;
141   need an 'append' msg attr for this
142
143 - re-enable resdump form arg
144
145 - deprecate response_cmd; have cmd_* handle next view
146
147
148
149 - make no changes without first seeing/writing a failing test case
150
151
152 UI
153
154 - basket page
155   x add asterisk to show highest price
156   x column to take you to page, column to take you to order book
157   x add bargraph
158   - description of page as subtitle
159   - help page
160
161 - content page
162   x clean up page_ctl; wrap in table etc.
163
164 - comments on orders
165
166 - wip publishing
167
168 - popup js graphs e.g.
169   http://wwwsmartmoney.com/etffocus/index.cfm?story=20060329
170
171 MODEL/CODE
172
173 - write market data reporting, use as default market home page
174   - "Things to do"
175     - descriptive paragraph, or ref wiki help page
176     - "Pages to review" -- pages that have not been traded recently
177         - contracts show_volume bottom 5
178     - "Pages to edit" -- pages with wip as highest price
179         - wiki show_wip top 5
180     - "Deletion candidates" -- contracts with lowest price
181         - contracts show_value bottom 5
182   - "Highest Rated" -- contracts with highest price
183     - contracts show_value top 5
184   - "Most Active" -- contracts with highest recent volume of orders
185     - contracts show_volume top 5
186   - "Top Traders" -- available - granted
187     x traders show_worth top 5
188     - traders show_trades top 5
189
190 - wiki link formatting for e.g. market:wiki.FooPage.3
191
192 - add bus reader methods to Order class, and remove all direct
193   references to Order -- there are only about 22, most in
194   specialist.py
195
196 - move Context to util, use in web_ui
197 - deprecate ctx.symbol, verb, args, func, and all other per-request
198   attributes in favor of bus and port attributes, doublecheck that
199   this makes redirects easier
200
201 - model classes e.g. Symbol are instrument-specific, so go ahead and define
202   them in specialist children, even though that binds model and controller
203   together too tightly; use message bus to get to them
204
205 - deprecate all direct calls to db from interpreter in favor of calls
206   via message bus
207
208 - move matching and other business logic to models
209  
210
211 THIS WEEK
212
213 - add testWebUI test
214
215 - populate ledger ref info
216
217 - portfolio too slow -- disabled history for now
218
219 LATER
220
221 - get db.commit() out of web_ui?  dispatch_request does db.close()...
222
223 - prevent duplication of data and effort: convert to using a make-like
224   algorithm for populating res; each cmd_* calls a series of res_*
225   methods, each method is named after its res subtree and vice
226   versa, each checks to see if the data is already populated before
227   creating it again; res is written by res_* only; any method can
228   call any res_* method and use the results
229
230 - XXX or just hang all that and turn every symbol into an object which
231   calculates and caches its own quote, position, order, and other data
232
233 - get rid of all direct ctx.res references
234
235 - move OrderQ to order.py
236
237 - get rid of show_*, use subcount()
238
239 - handle database lock/retry in ui
240 - move all mentions of req out of command interpreters; use authname in ctx
241
242 - migrate to fixed-place decimal from float -- change db data type to
243   (13,3) precision
244   - alternative is to just use SQL round(X,Y) during reconciliation
245
246 - rescale tests to basket_price = 100
247
248 patch: move handle_ta until after change_listener calls
249 patch: pass db to change_listener
250 use db in change_listener, kill that get_db_cnx
251
252 scripting language, with optional rollback on error
253
254 currency exchange
255     fx.USD b 100 5.5
256     fx.USD s 15 6.2
257
258 withdrawals -- cash
259     from 'payable' account
260     portfolio withdraw 67 USD
261 deposits -- credit card, cash
262     into 'receivable' account
263     support POST...
264     portfolio deposit 67 USD
265     > 1234 5678 9012 3456
266     ...resulting ctx object includes instructions for ui to get stdin or POST
267 balance transfers out of own avail acct
268     portfolio pay foo 23 TMP memo jslkajfd slkjfd klsa flak
269
270 write Auditor.cmd_reconcile
271
272 implement cli interface
273 write crashme
274
275 migrate interfaces to api.py, clean up imports
276
277 indexes
278 permissions
279 timeline provider
280 autodelete page versions below a configurable threshold price and last
281     trade age
282
283 allowance for activity
284     number of pages whose default viewable were created by trader
285
286 handle e.g. wiki page content updates via cli
287     wiki.FooPage content
288     > jfdsa lkjfdsa lksjf lsakjf lsakjf
289     > ...
290
291
292 trade arbitrary products via 'market' specialist
293     market.blah buy 67 .23 TMP
294     market.blah buy 67 .23 TMP from foo
295     market.blah sell 67 .23 TMP to foo
296
297
298 TENTATIVE
299
300 - model requirements/implementation
301   - cache results of db lookups and other expensive operations
302   - build a res tree that is same namespace as url path
303     - market/wiki.FooPage.3 -> market.wiki.FooPage.3.*
304     - market/portfolio -> market.portfolio.balance.*
305     - cmd_* are responsible for maintaining this tree
306   - works like HSM
307     - "inodes" are IMarketModel implementors; they register path
308       support via inode = model.open_path(path)
309     - "data blocks" are results of inode(verb, args)
310     - 'wiki.FooPage.3 buy 3 .23' causes:
311         inode = model.open('wiki.FooPage.3')
312         inode.buy(.23)
313     - refactor ICommandInterpreter to use IMarketModel
314   - any model must be equally accessible from any controller
315     - pretty much dictates use of IMarketModel
316     - model.factory(ctx, name, id) returns the model obj
317
318
319   - move all business logic out of controllers
320     - can be in same module, but not in same class
321     - need to move most config.get() into models; probably need a
322       Config model
323   - clean access syntax (avoid explicit search loops)
324     - wrapper in Context
325     - ctx.Symbol('wiki.FooPage') calls model.factory(ctx.res,
326       'Symbol', 'wiki.FooPage') on each model, stores the resulting
327       obj when it gets one back
328   - fast access (avoid search loops altogether)
329     - ctx stores model obj for re-use, in ctx.model[name][args]
330   - works for both sync and async apps
331     - controller passes View obj to model constructors, e.g.
332       model.factory(ctx, ctx.res, 'Symbol', 'wiki.FooPage') creates a model
333       which will write to ctx.res.Symbol.wiki.FooPage.*
334     - frontend models can create and pass a different view obj to
335       backend models
336       - Symbol creates view = View() and passes that to Order, Order
337         writes to view.Order[id].*
338     - model sets viewobj.model_class.* whenever data is fetched/changed
339       - DbObject.insert and DbObject.update set
340         viewobj.[table_name][id].*
341
342
343 - root model classes are Symbol, Order, Quote, Account, Entity, Deal
344
345 - data path is controller -> model -> viewobj
346 - e.g. cmd_show -> Symbol (calls db) -> ctx.res.Symbol
347
348
349
350 - clean up basket when hitting next symbol-related bug > 1 hour:  Just
351   clean up model and this will take care of itself.  XXX not this:
352   Start by grepping for the variable 'basket', and removing it by
353   turning all uses of 'symbol' from a string into Symbol class; a
354   Symbol can contain other contracts, recursiveley, with each Symbol
355   also having a 'basket' attr; wiki.Symbol inherits from
356   command.Symbol; probably move all non-cmd_* methods from Specialist
357   to Symbol or other models
358
359
Note: See TracBrowser for help on using the browser.