Commit Graph

41 Commits

Author SHA1 Message Date
quazzuk d0938e9149
Added support for init and close open_orders_accounts instructions (#99)
* added support for init and close open_orders_accounts instructions

* removed unused variables
2021-12-23 18:16:09 +08:00
Imaclean74 7d10ecc9eb
Replace Deprecated Account type with Keypair (#92)
* Replace Deprecated Account type with Keypair

* revert python version change

* removed comments, unnecessary spaces

* require solana-py >= 0.15.0

* fixed mypy errors

* fixed account loader

* Fix lint error

* fixing market tests

* fixing async_test_ market for Keypair

Co-authored-by: Ian MacLean <Imaclean74@github.com>
2021-11-03 20:57:08 -05:00
Kevin Heavey 954732976d
Add async support (#82)
* add async utils and connection

* refactor market.py before adding async

* add async open orders account

* add async_market

* add type hint

* replace pytest-tornasync with pytest-asyncio

* add async tests

* add async tests

* linting

* add async exmplae to README

* fix unit test selection

* bump minor version number

* chmod

* fix keygen error when key already exists

* use --cov-append

* fix coverage for multi test

* fix typo

Co-authored-by: kevinheavey <kevinheavey123@gmail.com>
2021-08-12 20:36:28 +01:00
Leonard G 19ae0c5a42
Fixed size bug. (#70)
* Fixed size bug.

* Fixed linting error.

* Updated version.

* Fixed linting error.

* Fixed linting error.

* Fixed bug.
2021-04-05 10:31:39 -05:00
Leonard G dad9a8e075
Support Serum v3. (#65)
Added support for DEX v3.
2021-03-01 17:49:04 +08:00
michaelhly 2944582a49 Validate settle_fund addresses to prevent settling to dex vault 2020-12-22 20:20:36 -06:00
michaelhly b902058fa7 Get token mints 2020-10-31 08:53:01 -05:00
Michael Huang 722935cb5f
Add load_orders_for_owner and get_live_markets (#52)
* true list of live markets and open orders

* linting fix

* remove unused req file

* moar lints

* fixing commitment with solana api

* using chain

* MOAR LINT

* Revert layout changes

* Revert state.py changes

* Move get_live_markets

* Format and lint

* Add test for get_live_markets

* Update README.md

* Address prior feedback

Co-authored-by: gitjcs <julien.collardseguin@gmail.com>
2020-10-29 18:17:29 -05:00
Leonard G fb219b9207
Added settle funds. (#45)
* Added settle funds.

* Added tests.

* Fixed bug.

* Removed unnecessary tests.

* Address comments

Co-authored-by: michaelhly <michaelhly@gmail.com>
2020-10-29 14:15:35 -05:00
Michael Huang d38cd2eef7
Bump solana to 0.5.0 (#48)
* Bump solana to 0.5.0

* Use TxOpts

* Use non-deprecated MemcmpOpts

* Fix lint errors
2020-10-05 21:02:12 -05:00
Michael Huang 135c770dcf
Changes for pypi release (#44)
* Adjustments for pypi release

* Remove if else

* Fix typo

* Revert "Remove if else"

This reverts commit 9beb895e56b4e9fa9d9a0b597671486afc84c072.

* Restore queue.py

* Revert "Restore queue.py"

This reverts commit d868475b0059d5d8c1c62132d9d031524e85729b.

* Restore event_queue_binary

* Restore other stuff

* Update README.md

* Fix version

* Address feedback
2020-10-01 10:37:32 -05:00
Leonard G ca281af3f1
Upgraded to v2 layout. (#43)
Upgraded Market and OpenOrderAccount to v2 layout.
2020-09-30 10:05:07 +08:00
Leonard G 34d7401d2c
Added SOL wrapping and cancel order by client id. (#40)
Added SOL wrapping and cancel_order_by_client_id.
2020-09-24 23:11:00 +08:00
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
Leonard G ffe76df0ea
Refactored state out of market. (#36) 2020-09-19 19:47:56 +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 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
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 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 3afaf9e731 Add alpha branch and pylint to workflows 2020-08-30 00:35:31 -05:00
michaelhly 5edd6f64fc Set up repo 2020-08-29 17:28:24 -05:00