Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unknown codes better #4

Merged
merged 2 commits into from
Jan 2, 2013
Merged

Conversation

cbilson
Copy link
Owner

@cbilson cbilson commented Dec 31, 2012

I often run into problems when a new, never-before-seen code comes up in something like :order-type. For example, this morning I requested contract details for "AAPL" :equity and one of the contracts had "ALGOTH" as one of the available order types. There is no entry for this order type in the code table for :order-type.

I don't know what that order type is and I don't care that much. It really shouldn't cause an error.

I think for some of the code tables, we should allow unknown values to just be translated into the literal value. So, for order type "ALGOTH" instead of trying to translate it into a symbol, just use the string value instead.

I think we can do this by modifying the translation table macro. I like the idea of having optional keywords before the map part, like the way the defmappingtest macro works in tests/../mapping.clj.

@ejackson
Copy link
Collaborator

On this topic. Is there significance to the different name conventions employed in translations.clj ? The keywords in the maps are sometimes ALLCAPS, sometimes lisp-hyphen-style.

@cbilson
Copy link
Owner Author

cbilson commented Dec 22, 2012

Yeah, the ALLCAPS codes are the ones that I don't know what the heck they
are. I see new ones all the time. I think I would just remove those from
the map and let them come out as strings. I don't think they are going to
be terribly useful to most people anyway and I keep seing new ones all the
time.

On Sat, Dec 22, 2012 at 2:22 AM, Edmund Jackson notifications@github.comwrote:

On this topic. Is there significance to the different name conventions
employed in translations.clj ? The keywords in the maps are sometimes
ALLCAPS, sometimes lisp-hyphen-style.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-11635835.

@ejackson
Copy link
Collaborator

Aaah, that makes sense. Removing them, and then just having unknown codes come in as strings would be really tide. Nice.

@ghost ghost assigned cbilson Dec 31, 2012
@cbilson
Copy link
Owner Author

cbilson commented Dec 31, 2012

I decided to only exclude string values from throwing, so (translate :to-ib :security-type :some-weird-value) will still throw, but (translate :to-ib :security-type "no really, this is just a valid value you've never seen before") won't throw. Same for :from-ib (where they are almost all strings anyway.)

@cbilson
Copy link
Owner Author

cbilson commented Dec 31, 2012

BTW, I noticed there were tabs in some of these files. groan. I'm sorry. Since I originally wrote them, at some point I added something to my emacs config to automatically un-tabify buffers on save. I made sure not to make all the whitespace nonsense part of these commits, just the relevant stuff, but at some point I'd like to clean up the whitespace. Maybe when all branches are closed, before a 0.1.0 release or something.

cbilson added a commit that referenced this pull request Jan 2, 2013
@cbilson cbilson merged commit 16c8083 into master Jan 2, 2013
@cbilson cbilson deleted the fix/handle-unknow-codes-better branch January 3, 2013 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants