@@ -46,12 +46,16 @@ Want to quickly make a trading app? Here you go:
4646 ``` terminal
4747 python -m pip install python_bitvavo_api
4848 ```
49+
50+ If you installed from `test.pypi.com`, update the requests library: `pip install --upgrade requests`.
51+
52+
49531. **Create a simple Bitvavo implementation**
5054
5155 Add the following code to a new file in your app:
5256
5357 ```python
54- from python_bitvavo_api.bitvavo import Bitvavo
58+ from python_bitvavo_api.bitvavo import Bitvavo
5559 import json
5660 import time
5761
@@ -74,7 +78,8 @@ Want to quickly make a trading app? Here you go:
7478
7579 # Handle errors.
7680 def error_callback(self, error):
77- print("Errors:", json.dumps(error, indent=2))
81+ print("Add your error message.")
82+ #print("Errors:", json.dumps(error, indent=2))
7883
7984 # Retrieve the data you need from Bitvavo in order to implement your
8085 # trading logic. Use multiple workflows to return data to your
@@ -85,22 +90,24 @@ Want to quickly make a trading app? Here you go:
8590 # In your app you analyse data returned by the trading strategy, then make
8691 # calls to Bitvavo to respond to market conditions.
8792 def a_trading_strategy_callback(self, response):
88- print("All the latest trades:", json.dumps(response, indent=2))
89- # Iterate through the
93+ # Iterate through the markets
9094 for market in response:
91- print("Iterate through markets:", market["market"] )
95+
9296 match market["market"]:
93- case "ABC -EUR":
94- print("Check data against your trading strategy. For example , the bid is: ", market["bid"] )
97+ case "ZRX -EUR":
98+ print("Eureka , the latest bid for ZRX-EUR is: ", market["bid"] )
9599 # Implement calculations for your trading logic.
96100 # If they are positive, place an order: For example:
97- # self.bitvavo_socket.placeOrder("ABC -EUR",
101+ # self.bitvavo_socket.placeOrder("ZRX -EUR",
98102 # 'buy',
99103 # 'limit',
100104 # { 'amount': '1', 'price': '00001' },
101105 # self.order_placed_callback)
102106 case "a different market":
103107 print("do something else")
108+ case _:
109+ print("Not this one: ", market["market"])
110+
104111
105112
106113 def order_placed_callback(self, response):
@@ -123,8 +130,8 @@ Want to quickly make a trading app? Here you go:
123130 limit = self.bitvavo_engine.getRemainingLimit()
124131 except KeyboardInterrupt:
125132 self.bitvavo_socket.closeSocket()
126-
127-
133+
134+
128135 # Shall I re-explain main? Naaaaaaaaaa.
129136 if __name__ == '__main__':
130137 bvavo = BitvavoImplementation()
@@ -138,7 +145,8 @@ Want to quickly make a trading app? Here you go:
138145 Replace the values of `api_key` and `api_secret` with your credentials from [Bitvavo Dashboard](https://account.bitvavo.com/user/api).
139146
140147 You can retrieve public information such as available markets, assets and current market without supplying your key and secret.
141- However, Bitvavo returns an error.
148+ However, unauthenticated calls have lower rate limits based on your IP address, and your account is blocked for longer if
149+ you exceed your limit.
142150
1431511. **Run your app**
144152
0 commit comments