Commit Graph

88 Commits

Author SHA1 Message Date
Michael Huang 444f89d899
Refactor orderbook out of market and move queue_ to _internal (#39)
* Move orderbook out of market

* Refactor slab out of layouts

* Clean up

* Move queue_ to _internal

* Explicit types for queue items

* Fix bug

* Remove construct comment

* Update comment

* order_info -> info

* Add comment about dropping BytesIO

* Freeze slab dataclasses
2020-09-21 11:03:20 -05:00
Michael Huang 8698ee15ec
More market refactoring and clean up (#37)
* Refactor MarketState

* Use noqa: F401

* Fix bugs

* Make market connection private

* Rename client to connection

* Any -> Container

* Refactor out types

* Clean up

* Add MarketOpt

* More scaffolds

* Add more TODOs and cleanup

* Replace market with market_state in orderbook

* Use Sequence[int] as typing for byte buffers

* Slab.decode -> Slab.from_bytes

* Rename all decode helpers to from_bytes

* Add market state from_bytes

* types -> t

* _market -> _market_state
2020-09-20 01:01:44 -05:00
Michael Huang a6c0f31f05
Set up code coverage (#38)
* Setup code coverage

* Update main.yml

* Use codecov.yml, add badges and clean up scripts

* Add pytest-cov to dev deps
2020-09-19 19:09:40 -05:00
Leonard G ffe76df0ea
Refactored state out of market. (#36) 2020-09-19 19:47:56 +08:00
Leonard G e7406f8c7d
[MINOR] Updated README. (#35)
Updated README to include the instruction to start Serum DEX in docker and also mention the source of truth for the market addresses.
2020-09-17 15:30:14 +08:00
Michael Huang 9abb0ca3a1
Replace raw endpoints with Client and scaffold remaining market functions (#34)
* Bump solana to 0.3.1

* Use client instead of raw endpoint

* Use TOKEN_PROGRAM_ID from spl.constants

* Scaffold unimplemented functions

* Rename open_order to open_orders

* Remove unnecessary code

* Remove unused import

* Add market client
2020-09-17 00:11:39 -05:00
Leonard G e2351f5134
Added order placement API. (#31)
Added order placement API including finding the open order account logic.
2020-09-16 23:04:28 +08:00
Leonard G 969c14f3e1
Added match and cancel order to market class.
Added the following:

- place order API
- cancel order API
- integration tests for existing functionalities
- split the run_int-test script into several files so that we can just start the docker image without running the integration tests
- fix the issue when the test fails but the build is still red.
2020-09-15 11:52:19 +08:00
michaelhly bdd3e418ec Add fixture for dex program id 2020-09-13 22:07:54 -05:00
Michael Huang 47b298e46d
Remove serum-dex dependency from integration tests (#30)
* Update integration script

* Remove serum dex dependency in integration workflow

* Udpate script and workflow
2020-09-13 21:49:18 -05:00
Michael Huang 2b9698c50e
Use dex binary (#29)
* Download dex binary

* Remove dex build from workflow
2020-09-13 20:36:55 -05:00
Michael Huang 43cfe1be57
Refactor bootstrapped fixtures (#28)
* Add wallet fixture

* Make format

* Extra verbose logging for int tests

* Update make scripts

* Refactor bootstrapped fixtures
2020-09-13 16:30:57 -05:00
Michael Huang 1cc4b7b052
Set up integration tests and workflow (#27)
* Set up integration workflow

* Add rust toolchain and cargo to workflow

* Add run_int_tests script

* Remove install cargo

* Fix script

* Install libudev-dev in workflow

* Update makefile

* Fix work flow

* Add integration tests

* Update scripts

* Update script

* Update script

* Run int tests script with sudo

* Move int tests back to last workflow item

* Update README and try fix

* Set url to localhost:8899

* Add python and pipenv set up to integratino workflow

* Install pytest
2020-09-12 19:56:43 -05:00
Leonard G 56ab481479
Added more instructions. (#24)
Added the following instructions:
- cancel order
- cancel order by id
- settle funds
2020-09-12 16:18:40 +08:00
michaelhly 03059f3474 Bump solana to 0.2.0 and add docker-compose.yml 2020-09-10 18:03:44 -05:00
Leonard G e020001a7f
Added Place order instruction and open order class (#23)
Added Place order instruction and open order class
Co-authored-by: Michael Huang <michaelhly@gmail.com>
2020-09-11 00:28:00 +08:00
Leonard G 31830db963
Added queue layout and load filled order. (#19)
Added queue layout for both request queue and event queue. Implemented load_request_queue, load_event_queue and load_filled_order for market class.
2020-09-04 23:16:39 +01:00
Leonard G b5703e8df8
Changed to dummy endpoint in tests. (#21)
Changed to dummy endpoint in tests.
2020-09-04 16:51:44 +01:00
Leonard Ge f02898dd55 Refacoted loadbid and loadask interface. 2020-09-04 00:39:19 +01:00
Michael Huang 52e4b929d5
Hide all layouts (#18)
* Hide all layouts

* Remove duplicate dex program ids
2020-09-03 14:46:36 -05:00
Michael Huang 99692036b5
Implement instructions (#16)
* Bump solana to 0.1.1

* Implement initialize market

* Implement match orders

* Implement consume events

* Fix enum type hints

* Use instruction layout

* Make specific layouts private and use enum to index instruction type

* Add tests for data parsing

* Add parsing tests

* Remove index constants

* Update tests
2020-09-03 14:11:53 -05:00
Leonard Ge 29baa580de Added get started in README. 2020-09-03 10:16:50 +01:00
Leonard G 2fe79e0134
Added wrapper class for Slab (#17)
Added wrapper class for Slab
2020-09-03 16:00:00 +01:00
michaelhly d732fda69a Remove unnecessary helpers for account flags 2020-09-02 18:26:44 -05:00
Leonard G 5d7ebc83f6
Implemented Slab and Orderbook class.
Implemented Slab and Orderbook class as well as the `load_bids` and `load_asks` method for market.
2020-09-02 22:03:56 +01:00
Michael Huang 52735daea1
Make account flags properties snake case (#15) 2020-09-01 16:10:47 -05:00
Michael Huang e566575ce2
Add dex instructions (#14)
* Dex instruction params

* Rename dex_program to instructions

* Remove enum layout for regular enums

* Add instruction layouts

* Scaffold functions

* Small fix

* Make struct properties camel case

* Fix comment

* Fix
2020-09-01 16:00:23 -05:00
Michael Huang a4de214acc
Add enum (#10)
* Add enum

* No duplicate enum values

* Add tests

* Fix value error message

* Address comments

* Make decode byteorder configuragble
2020-08-31 15:29:43 -05:00
Leonard G f4749d63e4
Added Market Structure. (#8)
Added market structure, implemented the `load` factory function.
2020-08-31 20:52:51 +01:00
Leonard G 0573484950
Implemented Slab Data Structure and Order Book Data Structure.
Implemented Slab Data Structure and Order Book Data Structure.
2020-08-31 15:47:13 +01:00
michaelhly f9668d4eab Remove _EMPTY_FLAG constant and add docstrings 2020-08-30 19:07:34 -05:00
Michael Huang 89014c6287
Account flags layout (#9)
* Account flag layout

* Add wrapper methods

* Replace empty flags with padding
2020-08-30 18:45:39 -05:00
michaelhly 4f3a9eeadc Disable pylint docstrings 2020-08-30 11:50:44 -05:00
michaelhly 384b9547be Remove pydocstyle from linters and update README.md 2020-08-30 08:31:11 -05:00
michaelhly 3afaf9e731 Add alpha branch and pylint to workflows 2020-08-30 00:35:31 -05:00
michaelhly ad78622dac Bump solana to 0.1.0 2020-08-29 23:33:08 -05:00
michaelhly 5edd6f64fc Set up repo 2020-08-29 17:28:24 -05:00
Michael Huang aefd471a5a
Initial commit 2020-08-29 16:47:19 -05:00