Mike Tom Posted November 25, 2019 Share Posted November 25, 2019 I'm trying to create an adapter in Streambase 10.5 for cryptocurrency exchange like binance, bittrex, deribit, etc.. I tried using REST (Web Reader Adapter) and Websockets Reader. The adapter can read, I can not understand how it works to have Market Data and send Orders.. Can you help me with this Link to comment Share on other sites More sharing options...
Steve Barber Posted November 26, 2019 Share Posted November 26, 2019 I'm not expert in crytpocurrency APIs, but looking at, for example, https://github.com/binance-exchange/binance-official-api-docs/blob/maste..., entering a new order into binance via HTTP is just a POST request with parameters probably in the PostData field, and you should be able to do it with the TIBCO Streaming Web Reader Input adapter. That is, this is a pretty standard looking web API. Your question is really rather general, could you please make it more specific Perhaps give an example of which API you are trying to use, what you have coded in EventFlow, and what problems you encountered (error messages, stack traces, failures, etc) The more concrete the detail in the question, the more concrete the answer can be. Link to comment Share on other sites More sharing options...
Mike Tom Posted November 28, 2019 Author Share Posted November 28, 2019 Can you help me how to solve the issue with polling The data is doubling. Polling settings to 1000ms See attachments Link to comment Share on other sites More sharing options...
Steve Barber Posted November 29, 2019 Share Posted November 29, 2019 I don't understand what you mean by "the data is doubling" -- all I see in the Output Streams view is that there is a tuple received approximately once every second. Sometimes those tuples contain exactly the same data, but that's because the ticker result values haven't changed at all during that interval. So, I'm not sure what problem you think you are having. Therefore, additional more specific descriptions of what you think you should be seeing as opposed to what you are seeing might clarify your question for me. Link to comment Share on other sites More sharing options...
Steve Barber Posted November 29, 2019 Share Posted November 29, 2019 For example, if I do this at a bash shell prompt: $ COUNTER=0; while [ $COUNTER -lt 10 ]; do date; curl https://api.gemini.com/v1/pubticker/btcusd; echo; sleep 1; let COUNTER=COUNTER+1; done Fri Nov 29 13:45:15 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:16 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:17 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:18 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:20 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:21 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:22 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:23 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:25 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} Fri Nov 29 13:45:26 STD 2019 {"bid":"7760.00","ask":"7760.01","volume":{"BTC":"941.7162381754","USD":"7193515.727353687243","timestamp":1575053100000},"last":"7760.01"} For all 10 requests, the returned object has exactly the same contents, presumably because no more trading activity occurred for the symbol during those 10 seconds. That is, the apparently replicated responses are what one would expect from this API during periods of low activity and such results are entirely independent of whether StreamBase is used or not. So, again, what is it that you think is a problem here Link to comment Share on other sites More sharing options...
Mike Tom Posted December 17, 2019 Author Share Posted December 17, 2019 I'm trying to create an application to connect with Bitmex and other exchange using websocket. I need to convert JSON to tuple and then add the data to Streambase Query Database. How i can work with this tuple values now This is list data type. Can you help me I attach an example I made using Bitmex. Link to comment Share on other sites More sharing options...
Steve Barber Posted December 17, 2019 Share Posted December 17, 2019 Hi Mike, Let me break down your new "Answer" here, which is really an entirely new Question and would have been better as a separate post to the Answers section. "I need to convert JSON to tuple" Well, clearly you've already done that. It looks like this tuple contains about 1 second's worth of top-of-book quote data for a symbol on BitMex. I'm a bit unclear why all those data points are included in a single tuple, though, but I guess that's how BitMex works. I guess they are throttling outbound traffic by packing all the top-of-book changes in a given time period into one JSON document, not quite a continuous stream but a compromise. "and then add the data to Streambase Query Database." Do you mean that you want to insert this tuple into a StreamBase Query Table What table What is the schema of the table you desire What would that table's primary index be Why do you want to put this data in a table What operations will you want that table to support after the data is in there Do you want that tuple in your screen shot to be a single row in a table Or did you want to take each element from the data list field in the incoming tuple to be a separate row in some query table Looking at the BitMex API, this particular message is a quote table insert, so my guess without knowing more is that a natural table representation would be to have a table name quote with a schema derived from one of the tuples in the data list, and have each element of the data list be a row in the quote table. There's no key specified so you can either generate a unique key for each list element, or use a compound primary index of symbol and timestamp because it appears that the timestamps are going to be unique per symbol, though that's always a risky thing to rely on. To do a BitMex insert operation you would first do a delete for all rows for that symbol, and then a Query Write Insert for each element of the list, so you probably want a secondary index on your quote table of symbol for efficiency. "How i can work with this tuple values now This is list data type." It's rather unclear what you mean by this question, so you might want to lay out your thoughts and application requirements more step by step, and in detail, with more precision, and then I'll have an easier time providing a useful answer. In general, to work with EventFlow lists you can iterate over a list with the Iterate operator, and perform operations on each list element using a sequence of EventFlow operators. Perhaps you want to write each list element separately to a Query Table. Another way to work with list data in EventFlow is with functions that operate on lists. I don't know, you haven't said much about what you want to do -- what do you mean by work with Maybe I partially answered your question with my suggestions above, but you are having me work in the dark here about the purpose of your application so I'm really just guessing based on my experience with securities trading applications in the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now