• last year
In this video I’ll be going over how you can use the Quiver Quantitative API to download and analyze our data. The API is also great for those of you who are interested in building backtesting tools or automated trading systems based off our data.

You can get a free one month trial to the API by visiting api.quiverquant.com and using the code ‘TWITTER’.

Let me know if there are any other datasets or API features you would like to see covered!

Category

🗞
News
Transcript
00:00 Hi guys, in today's video I'll just be showing you briefly how you can connect to the QuiverQuant
00:06 API.
00:07 I will then download some congressional trading data and do just a little bit of brief analysis
00:14 with that data.
00:15 But what you want to start by doing first is, as you can see, pip installing QuiverQuant,
00:19 importing QuiverQuant.
00:20 What you'll need to do next is have access to a key for the API.
00:26 For those of you that are interested, you can go to api.quiverquant.com and sign up
00:31 for a key there.
00:32 If you use the code "twitter" you will get a one month free trial, which is pretty cool.
00:39 So you can read the key in.
00:43 Once you run this cell that I'm writing out here, you should be connected to the API.
00:48 And then I'll show you how you can call some of the different endpoints.
00:51 Like I said, today we'll just be looking at some of the congressional trading data, but
00:55 there's quite a few other endpoints.
00:58 In the future I'll probably be looking to do some videos corresponding to some of these
01:02 other endpoints.
01:03 So let me know, in fact, if there's any of the other data sets that you would like to
01:07 see covered from the perspective of the API, and I'll work on those videos.
01:14 So you should note that the endpoint will only return a thousand rows of data, unless
01:18 you set the parameter "recent" equal to "false".
01:22 And then you can return all of the historical data from this particular endpoint.
01:27 But so yeah, as you can see here, this is what the API will automatically return by
01:32 default, which is just a pandas data frame showing the trade data, pretty much the transaction
01:38 date, the filing date, the stock that was traded, the representative.
01:43 So what I'll be doing next here is just writing a little bit of code, like I said, that will
01:50 download price data for each ticker in the data frame, but I'm going to first limit it
01:57 to trades made only in 2023.
02:01 But what this code here will do is connect to the Y-Finance library, which is a pretty
02:07 cool library.
02:08 It's completely free, and it basically just has a lot of stock data, like stock price
02:14 data and whatnot.
02:16 So yeah, like I said, what I'll do is download price data for each of the stocks in the data
02:22 frame.
02:24 And what I will then do is essentially try to estimate a return on the trade for each
02:30 trade in this data frame, right, again, just from trades made in 2023.
02:34 And what I'll do from there is then just a little bit of analysis, looking at which trades
02:40 have been the most successful, which trades have been the least successful, from both
02:44 a positive and negative return perspective.
02:47 So I'll probably just speed up the video a little bit from here on out while I finish
02:51 up writing up this code.
02:53 I won't go too much into depth here, mostly just because this code is pretty straightforward,
02:58 but also because I imagine that most of you will probably want to write your own back
03:04 testing tools, like I said, or trading algorithms.
03:06 And so yeah, I just won't go too much into depth, but you can always pause the video
03:13 and take a look at the code if you're interested in copying along.
03:16 So go ahead.
03:22 So just to clarify, I'll basically be using each transaction date from each row as a start
03:28 date and then using the most recent date as an end date and returning closing price data
03:35 from the Y Finance library to create a return on trade column, which I'll add to the data
03:43 frame, which you can see here.
03:47 And now you can sort the data frame from the return after trade column and also isolate
03:52 the data frame into both just purchases or just sales.
03:56 From there, you can, of course, recognize representatives who have made well-timed trades,
04:04 and I'll be doing a little bit of that over the next minute or so of the video.
04:08 But for the most part, I hope you guys enjoyed and please do, like I said, let me know in
04:13 the comments if you would like to see some other API tutorials like this from the perspective
04:18 of other datasets or endpoints.
04:21 But yeah, hope you guys have a great day.
04:24 Bye.
04:25 [END]
04:26 1
04:27 Page 1 of 2
04:27 Page 2 of 3
04:28 Page 3 of 4
04:28 Page 5 of 6
04:33 Page 6 of 7
04:38 Page 8 of 9
04:43 Page 9 of 10
04:48 Page 10 of 11
04:53 Page 11 of 12
04:58 Page 12 of 13
05:03 Page 13 of 14
05:08 Page 14 of 15

Recommended