durtal / betfaiR

R package for the Betfair API
http://durtal.github.io/betfaiR/
Other
18 stars 6 forks source link

clean up code #6

Closed durtal closed 8 years ago

durtal commented 8 years ago

with the addition of more methods some of the code could use a bit of clean up. Functions like replaceInstructions and limitOnCloseOrder are doing very similar things, rather than having multiple little functions perhaps think about storing them in a similar fashion to the [betfair] environment.

This would reduce the number of functions being exported.

Also look to change names from betfair_parse to shorter bf_parse

durtal commented 8 years ago

Functions to change from betfair_* to bf_*

These often return lists with unique class to be printed in a certain format, these classes can also be improved on.

Order functions to group together

Current NAMESPACE (below) reveals a few inconsistencies which would be reduced with cleaning function names (and object classes) from above

S3method(betfair_parse,cancelOrders)
S3method(betfair_parse,competitions)
S3method(betfair_parse,countries)
S3method(betfair_parse,eventTypes)
S3method(betfair_parse,events)
S3method(betfair_parse,marketBook)
S3method(betfair_parse,marketCatalogue)
S3method(betfair_parse,marketProfitAndLoss)
S3method(betfair_parse,marketTypes)
S3method(betfair_parse,placeOrders)
S3method(betfair_parse,venues)
S3method(betfair_request,cancelOrders)
S3method(betfair_request,competitions)
S3method(betfair_request,countries)
S3method(betfair_request,eventTypes)
S3method(betfair_request,events)
S3method(betfair_request,marketBook)
S3method(betfair_request,marketCatalogue)
S3method(betfair_request,marketProfitAndLoss)
S3method(betfair_request,marketTypes)
S3method(betfair_request,placeOrders)
S3method(betfair_request,replaceOrders)
S3method(betfair_request,venues)
S3method(print,betfaiR)
S3method(print,betfaiR_login)
S3method(print,betfair_orders)
S3method(print,bf_cancel_orders)
S3method(print,marketBook_list)
S3method(print,marketBook_simple)
S3method(print,marketCatalogue_list)
S3method(print,marketCatalogue_simple)
S3method(print,marketPnL_list)
S3method(print,market_PnL)
S3method(summary,betfair_orders)
S3method(summary,bf_cancel_orders)
S3method(summary,marketBook_list)
S3method(summary,marketBook_simple)
S3method(summary,marketCatalogue_list)
S3method(summary,marketCatalogue_simple)
export(base_request)
export(betfair)
export(betfair_POST)
export(betfair_check)
export(betfair_login)
export(betfair_parse)
export(betfair_request)
export(cancelInstruction)
export(limitOnCloseOrder)
export(limitOrder)
export(marketFilter)
export(replaceInstructions)
durtal commented 8 years ago

Made a start on this branch, with a couple of commits changing existing function names and removing old docs.

Have added new bf_helpers environment which includes the small helper functions used for managing orders.

Branch has been deleted

durtal commented 8 years ago

addressed in this commit