Adding other exchanges p.2 - Tkinter tutorial Python 3.4 part 21
Key Takeaways
The video demonstrates how to add support for other exchanges, specifically Bitstamp, to a Tkinter GUI application using Python 3.4, and covers topics such as data retrieval, API integration, and GUI customization using tools like Tkinter, Python 3.4, BTCE, and Bitstamp API.
Full Transcript
Hey everybody, what is going on? Welcome to the 21st Tkinter Mega Series tutorial. Our Tinter series can now legally drink in the United States. That's pretty impressive. So, um, what we're going to do in this one is we're going to add, uh, support for the other exchanges. So the first thing that we're going to go ahead and do is um if you look down in our animation tutori or animation function rather uh you'll see here that we have uh colors that we plot with. That's kind of a mistake because we're we're hard coding these colors. In reality we have a light color and a dark color that we're using. Um, but as we add more exchanges and add more time frames and what we're going to graph, if the time comes down the road where we decide, hm, let's change our colors, we're going to have a really hard time because we're going to have to go through and and change all of these colors. Now, it's conceivable that you could do control H and you could hunt for this specific, you know, 00 or whatever. That's not the best way to do it. Um, so now I'm going to show you guys a way that we can fix that. Uh so first let's go ahead and let's just uh we'll copy this one. The other one is 183 A54. So come up to the very very top here. And uh basically we'll just put it right here. Uh we're going to have dark color equals something. And that's our 183. And then we have light color equals something which is 00 a3 e 0. Uh and then our dark color was 183 a54. So now we have dark color light color. Dark color is the 183. So animate come down here. 183 is the dark color. Boom. Paste. And then we paste light color in here. So now instead we have uh these variables that we're using. Bring this up. Agree. And what has happened? Uh uhhuh. Up to the top here. Did we not put Yeah, we didn't put a pound sign there. Let's go ahead and fix that one more time here. And I'm not sure. I think volume we've we've uh left hardcoded. So volume needs to be dark color. Find anime. We fil where's my mouse? There it is. Filled these in. Now let's go ahead and call that dark color. Fancy that. Okay. So now what we're going to do is add in the actual Exchange support. So this block of code is very specific uh to BTCE. Uh let's get rid of here. And now try and what try uh the first question we're going to go ahead and ask is if the exchange equals BTC-e. So if that's the exchange we're using, well then hot diggity, this is the code we use. So we take all this code and tab over once and everybody is a winner. Now we have uh the question of bitstamp. So let's go ahead and uh we're going to copy basically all of this for the most part. So copy and then come down here. Enter. Enter one over. if exchange equals bitstamp colon paste. Scroll up and bitstamp uh the data link for bitstamp is going to be https colon www.bitstamp.netransactions net slapi sltransactions slash uh we open up the data link. No different. We let's see PD um trying to see what is any different here. UTF8 we are going to load the data. Um I don't think pan or uh bit thinx or bitstamp rather does the nonsense about uh yes so they just straight up give you the data. Okay they don't tell you BTZUSD. All right so this it just starts right away with dates and all of that. So with bitstamp we don't need this right redefinition of data equaling data BDCUSD. So we can just delete that for now. And then we go ahead and convert it to a data frame. No problem. And the only other question is the buys and sells. And actually, you know what? Um, I don't think I don't think that um, Bitstamp doesn't differentiate between buys and sells. So, actually, we would change um the data here. We're going to go ahead and say volume can stay as uh volume equals data amount. Uh, however, we're going to go ahead and do apply whoops float and then dot oops dot to list. Um, a clear is fine. U, we don't have buys and sells. So, we'll just do this. And I'm going to do alt three here to comment all of that out. And when we actually plot um we'll do so we've got volume and then we plot date. We'll just get rid of one of these. So here plot date. Um we're going to do do we get date stamps? No. So plt.plot plot dates. We do all dates and then in here we just plot uh data price fill between again all dates uh that's fine and zero volume face color that should stay the same. Uh, instead of BDCE, this is bit I can't even remember if we're on Bitstamp or Bitfinex. So, Bitstamp and they give us uh string data price from most recent. So, that would be a zero. We set the title. And let's go ahead and save and run that and see if if that works out for us. So that's BTCE. Now we go here and change that to bitstamp. Okay. Uh failed because of timestamp. So let's close this. Come back here. Okay. Right. So data. Let's see. Theirs is date. So let's try that one more time. Agree. Exchange Bitstamp. Same kind. Let's close out of this. Let's do Okay, so you've got data date stamp equals um as type. Then we're going to do date stamps equals data date stamp and then dot to list like that. Uh we're not going to use all dates anymore. We'll use date stamps. Copy. Come down here and we're going to change that now to date stamps. Date stamps. Let's try that again. And agree exchange bitstamp. Still angry with me. Uh let's see. So the problem was it's date information that we're pulling. Uh day stamps, date stamps. So data day stamps and data date. Oh, okay. So, uh we're going to convert this. It's probably coming it's coming through as a string, I guess. Um so we'll dot we'll do apply int and actually uh cut that and we do apply int there and then as type. So let's try that one more time. There we go. Okay. So, now we've got the Bitstamp stuff. Uh, a lot a little bit more conversions than I wanted to do. Uh, but Bitstamp doesn't differentiate between uh the buys and the sells. So, that's kind of uh problematic. And then their ex, you know, their API feeds data a lot uh in a different way than uh than BTCE does. So that's what's kind of annoying when you don't have normalized data. They're all a little bit different. Uh so you've got to handle their data um specifically how they give it to you. So anyway, uh so now uh we've got price and volume there. We they don't differentiate between buys and sells, so we can't really do that. Uh but we do have volume and we do have the last price. Uh we just don't know if it was buy or sell. So, um, so now that we've got that, let me see the other thing. Let me go do ICICO real quick. Right. Okay. So, if you didn't notice, uh, when we went to go run that, uh, our client logo has has shifted again or shifted off of what it used to be. Let me go ahead and take this. We're going to cut. Let's go to the very very very very bottom here, right after self.show show frame and let's try to stuff it down there at the very bottom. There we go. Okay, so it was being overridden. Uh that was a problem. So anyways, now we've got our logo back and uh we're showing Bitstamp and now we need to add uh the other exchanges as well. So the other exchanges have their own little quirks as well. So uh we'll do that and I think I'll save that for the next video or hopefully we'll be we'll add the other the next two exchanges in the next video. So uh stay tuned for that. Uh, if you guys have any questions or comments, feel free to leave them below. Uh, let me go ahead and get us back to the animation function. Um, and scroll down a little bit. Uh, the code will eventually find its way onto Python programming.net. Just takes me a while sometimes to put up the code. Uh, but here's the first block of code before the clear if you needed that if something's going wrong. That's the first block. And then I can scroll down a little bit. uh down. And this is the second block of code. So if you need anything, pause it, look at it, figure out what you need. Uh this is in 1080p, so should be able to read that just fine. Okay. So anyway, next video we'll probably hopefully the next two exchanges uh and then we'll actually get into plotting candlesticks, all that kind of stuff. So out of this kind of nitty-gritty nonsense. So anyways, stay tuned for that. Questions, comments below. As always, thanks for watching.
Original Description
Tkinter GUI TutorialPlaylist: http://www.youtube.com/playlist?list=PLQVvvaa0QuDclKx-QpC9wntnURXVJqLyk
This Tkinter GUI programming tutorial covers how to actually have our exchange choice option change the exchange that we are viewing.
http://seaofbtc.com
http://sentdex.com
http://hkinsley.com
https://twitter.com/sentdex
Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
More on: Tool Use & Function Calling
View skill →
🎓
Tutor Explanation
DeepCamp AI