DTN_Gary_Stephen
-DTN Guru-
Posts: 396
Joined: Jul 3, 2019
|
Posted: Sep 21, 2023 08:31 AM
Msg. 1 of 1
class IQFeedSocket : Socket() { fun start() { connect(InetSocketAddress("localhost", 9100)) val brBufferedReader = BufferedReader(InputStreamReader(this.inputStream)) val brBufferedWriter = BufferedWriter(OutputStreamWriter(this.outputStream))
// Initialize the protocol, this prepares us for commands to come and verifies that our socket is working as intended. brBufferedWriter.write("S,SET PROTOCOL,6.2\r\n") brBufferedWriter.flush()
brBufferedWriter.write("HDX,AAPL,30\r\n") brBufferedWriter.flush() thread { var line: String while (brBufferedReader.readLine().also { line = it } != null) { println(line) } brBufferedReader.close() brBufferedWriter.close() close() } } }
Sincerely, Gary Stephen DTN IQFeed Implementation Support Specialist
|