Update the brief example in the README.md #22
Update the brief example in the README.md #22
Conversation
The existing example is not functional, mostly because of the change from `load_orders` -> `load_orderbook`. This commit amends the example to be functional, with a small change to place the order at a value we'd typically expect to see in the orderbook representation rather than a fixed $ value, which is hopefully a bit easier for a first time user to understand when they can see their order in the orderbook. I have kept the `print` convention of the existing example,
Thanks for tackling this! I take your point about f-strings but I wanted to avoid them in this example. I wanted to keep this one as basic as I could, and I'd get rid of the \n and \t if I could do it simply. I like the idea of The more realistic examples are in the I appreciate the idea of using the oracle to get a realistic price so that the order appears in the output, but I'd rather avoid using an oracle if we can. The idea behind buying at $10 was partly because the order wouldn't be filled - I worry that a beginner might accidentally run this code against mainnet instead of devnet and I didn't want them to suddenly have an unexpected SOL-PERP position. Can you think of another way of adding the order so it appears in the orderbook output but is unlikely to be filled? Nothing immediately occurs to me but I'm hoping you might have an idea or two. If not, we'll go with your oracle-based approach (it's important for the user to see their order), but maybe adjust it a bit? Thanks again for looking into this. |
Thanks for the feedback Geoff, appreciate it! I think your points and concerns RE: the code being applied to mainnet make sense. Happy to make the suggested changes
I see a few options, we could:
Let me know if you would like me to implement any of the above, no worries if not. I'm fine with removing the oracle code and just keeping it to a $10 bid or similar. |
Using How about every time we show the orderbook, we then show the user's orders? The first and third entries should be empty, and the second one should show one order - the one just placed. That should show them both the context of the orderbook, as well as the details of their order which may not appear in the top orderbook entries. How does that sound to you? |
Sounds good, I'll implement later today! |
I've implemented your suggested changes, with a minor change to wording for increasing clarity in the logs. Log output from the example included below:
|
Brilliant! Thank you so much for this! |
The existing example is not functional, due to the change from
load_orders
->load_orderbook
in this commit.This changeset amends the example to be functional, with a small modification to place the order at a value we'd typically expect to see in the orderbook representation rather than a fixed $ value, which is hopefully a bit easier for a first time user to understand when they can see their order in the orderbook.
I have kept the
print
convention of the existing example, but please let me know if you would prefer it be changed to a Python 3.7-esque syntax with f-strings etc.Log output from the example included below: