473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DDE (eSignal)

I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab

Nov 30 '06 #1
2 5798
BBands schrieb:
I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab
Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
>>'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb \x12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0]
'1402.670000000000'
>>>
Thomas

Nov 30 '06 #2
Thomas Heller wrote:
Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0]
'1402.670000000000'
float(last.split("\0")[0]) works for me.

Thanks for that!

jab

Nov 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.