In Twitter API (https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tweet-object), some of the fields are Int and some others Integer which are Nullable. For instance retweet_count is Int, but favourite_count is Integer (which is Nullable). What does it mean for favourite_count to be Nullable? and why favourite_count can be Nullable but retweet_count cannot?
I asked a similar question a few years back on the Twitter forum.
For scalability, the Twitter API has eventual consistency. The effect is that sometimes you won't receive all of the data or the data hasn't been updated.
Because of this, some fields are marked as nullable to indicate that there may or may not be data for that field, but we don't know at the time of the query.
Related
I have access to Twitter API for Academic Research, and I'd like to get the follower count on a given date of a user, or at the time of a tweet.
The doc mentions that "This fields parameter enables you to select which specific user fields will deliver in each returned Tweet.", so I assumed that by adding public_metrics to the users.field, the number of followers can be seen in each returned Tweet, however, in each returned Tweet, I can only see user_id. https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference.
Is it even possible to achieve what I want with Twitter API for Academic Research? Is there any other approach to make it?
Thank you so much.
You cannot get the follower count on a specific date; it will always be the count at the time you make the API call.
You may need to add expansions to your API call in order to receive the values you are trying to pull out.
Currently I'm checking if a tweet was created after another tweet based on the timestamp, but this is proving inconsistent. What is working locally is not working all the time on my server. I suspect a timezone issue (my server is in another time zone).
But I was wondering if I can do this based on Twitter's unique ids for each tweet? Something in the form:
if (tweet2.id > tweet1.id) {
// tweet2 created after tweet 1
} else {
// tweet2 created before tweet 1
}
Is this possible? If not I'll ask another question about what could be going wrong with my date implementation.
Twitter ids are generated by twitter snowflake mechanism which
is an algorithm and a cluster of machines to produce it. In general
those id's are sequential so your comparison will basically hold. The
problem is those id's are currently > 64 bits so js will truncate
those. The trick is to use tweetXXX.id_str field which is the id
casted to a string for your comparison.
I haven't see your date implementation but probably you are no comparing UTC date values. Any way comparison made on datetime will not give you correct results even on ms scale there will be many tweets on same date time.
With JIRA REST API there is at least 2 ways to get an issue:
/jira/rest/api/2/issue/{issueIdOrKey}
/rest/api/2/search?jql
I use both of them in my project but they return a slightly different results for updated field for the same issue.
Get by key: 2014-07-18T17:53:02.594+0300
Search: 2014-07-18T17:53:02.000+0300
By some reason milliseconds in search response are not set. It looks like a bug for me, but maybe there is configuration setting or something?
PS: I have the latest JIRA version (6.2.6)
JQL search results are generally fetched directly from the Lucene index, which stores timestamps with only millisecond resolution, whereas fetching the actual issue gets the date directly from the jiraissue table in the database, which can have sub-millisecond resolution (at least depending on your configured database).
EDITED: I see that I misread the precision above: the timestamp returned by getting the issue returns only milliseconds (vs nanoseconds) and the JQL query returns only integer seconds (vs milliseconds), so the Lucene data type linked above is not relevant.
However, the answer is still the same: JQL gets the result from Lucene, while an issue fetch gets the value directly from the database. On further investigation of why the Lucene index is not returning milliseconds: in the JIRA source in BaseFieldIndexer.indexDateField, JIRA calls LuceneUtils.dateToString(date) to convert the created field into a value that is indexable by Lucene. The dateToString method explicitly converts the field into an integer number of seconds (lopping off any milliseconds in the process), and it then converts the number to a String representation for indexing purposes.
Odd! I checked this with a 6.2 instance and also got a difference:
JQL: updated: 2014-07-11T19:34:04.000-0500
Key: updated: 2014-07-11T19:34:04.768-0500
I bet the code that returns the list of issues from a search uses a different date formatter that clears the milliseconds, whereas the one that returns the data from a single issue doesn't do that. I don't know of any configuration setting that would affect that.
I recommend filing it as a minor bug at http://jira.atlassian.com/browse/JRA
Minor because any code that is checking something based on ms seems unwise.
I would like to search for a tweets within a range of between dates by using Twitter API v1.1
let Query query=new QUery(String query);
what is the query thats suits for my question ??
Thanks in advance for reply back.
I suggest setting until to limit your query to an upper date bound, e.g.:
query.setUntil("2014-07-01");
Then step back through the result set, by making subsequent search calls, until you hit your lower date bound.
Be aware that the search API may not contain all Tweets and it may not 'go back' as far as you need. For more information on it, and other query parameters, take a look at Twitter's documentation on searching.
I'm attempting to run Interactive Broker's included code sample.
http://www.interactivebrokers.com/download/JavaAPIGettingStarted.pdf
On about page 42 it details how to pull market data feeds. My question is, has anyone successfully put in the parameters needed to pull currency pair data??
public synchronized void reqMktData(int tickerId, Contract contract, String genericTickList, boolean snapshot)
I cannot find the valid inputs that will correct the errors I'm seeing from the client.
Parameters needed
List of values inside Contract class are here : https://www.interactivebrokers.com/en/software/api/apiguide/java/contract.htm
STK == "stock" , should this be set to CASH for Forex data?
IDEALPRO == the exchange according to this page : http://ibkb.interactivebrokers.com/tag/fx-trader
USD.JPY = SYMBOL (this here is a guess on my part)
USD == "underlying currency" , here I am guessing again.. seems the currency needs to match the transaction currency.
the pair in the format Transaction Currency.Settlement Currency (example: EUR.USD). The Underlying column will display only the Transaction Currency.
After scouring IB's forum I have found something that works for FX data feeds. You need to put the TransactionCurrency as the Symbol, and the SettlementCurrency as the underlying in the dialog box.
Here is the resulting data feed
As I can remember, I used: CASH, IDEALPRO, EUR.USD, USD
You can see all parameters example in the TradeStation client. Just find the needed instrument and look at it's properties.
And remember that not all parameters must be necessarily filled
At the worst, show the error.