Jump to content

ini read


Recommended Posts

Hello.

I have managed to read a header in ini-file which is what i want.

This is to send a buy/or sell-order from a technical analysis-program.

What i want is to send this by tcp in future to the dealer.

I can get information from section in ini-file, but my problem is that

the order can't be sent every 15 second (expensive) until next order

comes some day later.

So how do you think i will solve this?

One possibility is to store last message from ini-file with timestamp in

a database table.

Another one can be to write new value from ini-file to a new file and

compare the results, then send the order.

The purpose to compare text is that not sending the order to dealer

several times...

Anyone having done this before?

:)

Edited by jorgeng
Link to comment
Share on other sites

Hi Jorgen,

Yes... Not for the same purpose but to manage password changes...

Your request is not very clear (no script sample) but I think if you include in your data a Sending TimeStamp you could manage that...

Ex :

#cs
Ini Data is as follow :
[MySection]
Dealer1 = YYYY/MM/DD HH:MM:SS , "Put here the data for Dealer 1
Dealer2 = YYYY/MM/DD HH:MM:SS , "Put here the data for Dealer 2
#ce
$Value = IniRead ( "filename", "MySection", "Dealer1", "" )
$a_Value = StringSplit ($Value, "," ,1); where $a_Value[0] contains the number of strings returned, $a_Value[1] contains the time stamp and $a_Value[2] contains the data

You can then test $a_Value[1] using _DateDiff function.

I hope this will help,

Bye

Hello.

I have managed to read a header in ini-file which is what i want.

This is to send a buy/or sell-order from a technical analysis-program.

What i want is to send this by tcp in future to the dealer.

I can get information from section in ini-file, but my problem is that

the order can't be sent every 15 second (expensive) until next order

comes some day later.

So how do you think i will solve this?

One possibility is to store last message from ini-file with timestamp in

a database table.

Another one can be to write new value from ini-file to a new file and

compare the results, then send the order.

The purpose to compare text is that not sending the order to dealer

several times...

Anyone having done this before?

:)

FreeRiderHonour & Fidelity

Link to comment
Share on other sites

This is my code:

$var = IniRead("D:\Program\FriendlyBörsActiveTrader\FBINET.INI", "SmsSendAs", "EP02", "NotFound")

MsgBox(4096, "Result", $var)

It will read every 5 second in a while-loop

i have to check that the value now isn't the same as 5 seconds ago to prevent sending orders to dealer too often....

The text which came from $var is:

11:34 ORDER "sl) Omx Wampa Sellstop - Kl.11 - Rosa - Okrypterat OMXS308E" kurs 994.2500$

:)

Edited by jorgeng
Link to comment
Share on other sites

Therefore you should include before the text, the timestamp and separate the two things by a coma (",")

This will give you something like that in your ini :

EP02 = "Put here the timestamps to the right format" <,> 11:34 ORDER "sl) Omx Wampa Sellstop - Kl.11 - Rosa - Okrypterat OMXS308E" kurs 994.2500$

Note that The coma is quoted between "<>" just to highlight it...

When you Send for the first time the data to your dealer just insert the Time Stamp before the value, this will avoid your script to send it again 5 secs later.

Use InirWrite to rewrite EP02 value.

OK?

Edited by FreeRider

FreeRiderHonour & Fidelity

Link to comment
Share on other sites

Therefore you should include before the text, the timestamp and separate the two things by a coma (",")

This will give you something like that in your ini :

EP02 = "Put here the timestamps to the right format" <,> 11:34 ORDER "sl) Omx Wampa Sellstop - Kl.11 - Rosa - Okrypterat OMXS308E" kurs 994.2500$

Note that The coma is quoted between "<>" just to highlight it...

When you Send for the first time the data to your dealer just insert the Time Stamp before the value, this will avoid your script to send it again 5 secs later.

Use Iniread to rewrite EP02 value.

OK?

Sorry, the ORDER row comes from my technical analysis program i can't affect the values sent in row.

Is this possible to do with comparing the $var variable?

:)

Link to comment
Share on other sites

I think we have a communication problem...

I'd like to know the exact process...

- An externat program updates your ini file => Exact ?

- Is the value always the same for each key (ex : EP02 = "NOKIA" / EP02 = "LEGO", etc...) ?

- Is the value re-updated after your Technical analysis program writes it for the first time ?

FreeRiderHonour & Fidelity

Link to comment
Share on other sites

I think we have a communication problem...

I'd like to know the exact process...

- An externat program updates your ini file => Exact ?

- Is the value always the same for each key (ex : EP02 = "NOKIA" / EP02 = "LEGO", etc...) ?

- Is the value re-updated after your Technical analysis program writes it for the first time ?

Yes, the EP02 is uppdated every 15 second for different stocks or termins OMXS308E is a termin.

The update is from my technical analysis-program.

EP02 is updated if market is open every 15 second.

Hope this helps...

Link to comment
Share on other sites

So if the value is updated regularly I suppose each update contains a different value.

If you scan your ini file periodically and you read each key in sections and if you perform a stringSplit for each value... you are able to see if

this value changed or not.

Put the following code into a loop and each time your Tech Analysis Prgm will overwrite EP02 value when you will try to split the value using "," no array

will be returned or if an array is returned it will not content "ALREADYSENT" string... This will signify the value is new and can be send to dealer.

$var = IniRead("D:\Program\FriendlyBörsActiveTrader\FBINET.INI", "SmsSendAs", "EP02", "NotFound")

$a_Var = Stringsplit($var,",",1)

If Not IsArray($a_Var) Or $a_Var[1] <> "ALREADYSENT" Then ; if a coma is in the original string this would avoid to not send an order which must be sent...

IniWrite("D:\Program\FriendlyBörsActiveTrader\FBINET.INI", "SmsSendAs", "EP02","ALREADYSENT" & $var) ; Rewrite the EP02 Value and flag it as sent.

; Do what you have to...

Else

; Put here the code you use to send the order...

EndIf

Hope It's more clear now...

FreeRiderHonour & Fidelity

Link to comment
Share on other sites

Thanks,

i think it will work, BUT i can't do an iniwrite since this will destroy my ta-program.

I can't change anything in the ini-file since the ta-program owns the file and i can't mess

in ini-file.

Do you have another solution?

:)

Link to comment
Share on other sites

What you can do is read the keys in the inifile owned by the ta-program and then create an other inifile containing the "orignial" value.

This will record the "original" value and you even don't need to insert the "ALREADYSENT" string.

You just have to compare the value your get from the ta-program's file with the one you have in your own ini file.

The problem is you have to read to files (it take more time)... But this is the only way.

Bye,

Edited by FreeRider

FreeRiderHonour & Fidelity

Link to comment
Share on other sites

What you can do is read the keys in the inifile owned by the ta-program and then create an other inifile containing the "orignial" value.

This will record the "original" value and you even don't need to insert the "ALREADYSENT" string.

You just have to compare the value your get from the ta-program's file with the one you have in your own ini file.

The problem is you have to read to files (it take more time)... But this is the only way.

Bye,

Ok, i will try it.

:)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...