Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
  1. #16
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    347

    Default

    Dear Jay
    Quote Originally Posted by jay.thakkar@gmail.com View Post
    Thanks a million.

    Adding, i am not able to update any parameters or updateclosedorder inspite of passing proper params.
    my code is:


    Dim result As VertexFXBOAPI10.CallingResultsEnum
    result = BOAPI.UpdateClosedPosition(78612087, 2992891, 2, 393.6, 406.55, 1000, 10, 5000, "")
    MsgBox(result)

    I am getting 1 as output still the order does not get updated.


    I am using BOAPI version 10.5.78
    Is there any version issue or I am going wrong?
    Please help.
    I have checked the issue from my side and found that you received an invalid amount for the updated position that closed partially or the new amount is larger than the fully mount , So to get the server response you have to wait the UpdatedClosedPositionResultReceived event to fire



    How to get the clientid for which the below mentioned event fires.
    I want to get the clientid for which the AccountHistory is belonging to..

    Private Sub BOAPI_AccountHistoryReceived(ByRef AccountHistory As VBA.Collection) Handles BOAPI.AccountHistoryReceived
    You have to know that the event fired for each account that you requested the history for when calling the GetAccountHistory , so by using the AccountByID function you can get the client id.

  2. #17

    Default

    Thanks you sir.

    I need to find the accountid from the ticketid in the above event. I need it as need to fire multiple update events by using loop.

    Dim AccHis As CAccountHistory
    Dim ticket As Integer
    Dim Interest As Double
    Dim Commission As Double
    Dim RefPrice As Double
    Dim Price As Double
    Dim lot As Double
    Dim profit As Double

    For Each AccHis In AccountHistory




    If AccHis.HisType = "L" Then 'And Val(AccHis.Comm) = 0



    Dim brokerage As Double
    brokerage = 0
    ticket = AccHis.Ticket
    lot = AccHis.Lots
    Price = AccHis.ClosePrice
    RefPrice = AccHis.RefPrice
    Commission = Math.Round((Price * lot + RefPrice * lot) / 10000000 * brokerage * 1000, 2)
    Interest = AccHis.Interest
    profit = AccHis.Profit
    Dim result As CallingResultsEnum




    result = BOAPI.UpdateClosedPosition(frmMain.myid, AccHis.Ticket, lot, Price, RefPrice, Commission, Interest, profit, CDate(AccHis.HisTime).AddMinutes(150).ToString)
    ' MsgBox(result)
    End If
    Next

  3. #18
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    792

    Default

    Hello Jay,

    Unfortunately you can not get the Account ID value using ticket ID. you must buffer the ID as you do in every call to GetAccountHistory method.

  4. #19

    Default

    Ok, thanks

    Adding, the below code outputs "InvalidIDResult"

    Dim Result As CallingResultsEnum
    Result = BOAPI.ChangeParam(78612085, ParamTypeEnum.MaxLotsType, False, 1111, BOAPI.SymbolByName("AXISBANK JUN").ID)

    MsgBox(Result.ToString)

  5. #20
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    347

    Default

    Dear Jay

    Quote Originally Posted by jay.thakkar@gmail.com View Post
    Ok, thanks

    Adding, the below code outputs "InvalidIDResult"

    Dim Result As CallingResultsEnum
    Result = BOAPI.ChangeParam(78612085, ParamTypeEnum.MaxLotsType, False, 1111, BOAPI.SymbolByName("AXISBANK JUN").ID)

    MsgBox(Result.ToString)
    The invalid ID result means that you are passing the wrong client ID, so make sure that you are enter the valid client ID not the account number .

  6. #21

    Default

    Dear Sir, you made my day. A humble thanks for all your help.

  7. #22

    Default

    Hi sir,

    I am connectiing the BOAPI with my back-office credentials. How to connect the same with client credentials?

  8. #23

    Default

    Click image for larger version. 

Name:	jay.jpg 
Views:	6 
Size:	245.0 KB 
ID:	571

    Hi there,

    please see the above image.
    the below mentioned static code closed a position.

    result1 = BOAPI.ClosePosition(78612087, 3003736, 1, 175.9, 176.40, 1, "C/F", Format(Now.AddHours(-5), "dd/MM/yyyy HH:mm:ss").ToString)


    Issue: The problem is that the profit is incorrect. It should be -0.50 and not -89.

    Please correct me if i am going wrong. I have used static values to simplify.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	error.jpg 
Views:	5 
Size:	12.1 KB 
ID:	570  

  9. #24
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    792

    Default

    Hello Jay,

    I am connectiing the BOAPI with my back-office credentials. How to connect the same with client credentials?
    You should use VertexFX Client API when you want to login as a client.

    Hi there,

    please see the above image.
    the below mentioned static code closed a position.

    result1 = BOAPI.ClosePosition(78612087, 3003736, 1, 175.9, 176.40, 1, "C/F", Format(Now.AddHours(-5), "dd/MM/yyyy HH:mm:ss").ToString)


    Issue: The problem is that the profit is incorrect. It should be -0.50 and not -89.

    Please correct me if i am going wrong. I have used static values to simplify.
    I can not judge if the PL is correct or not because it depends on the symbol setting values (contract size, Ref Symbol calculation, Direct/Indirect), however are you sure if you send a correct RefPrice?

  10. #25

    Default

    By ref price, you mean the opening price of the position. I hope i am right.

    Contract Size:1 for the above situation.

    I didnt figure out about Ref Symbol calculation, Direct/Indirect.

    Please help.

  11. #26
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    792

    Default

    Hello,


    RefAskPrice & RefBidPrice is a properties in COSymbol object. so when you try to close any position you must get the symbol object of the position then pass Symbol.RefAskPrice & Symbol.RefBidPrice to ClosePosition method.

  12. #27

    Default

    I am using VertexFXBOAPI10 where as your link to closeposition has different parameters.



  13. #28
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    792

    Default

    Hello,

    I am using VertexFXBOAPI10 where as your link to closeposition has different parameters.
    It's almost the same, you have to send a correct RefPrice

  14. #29

    Default

    The link you mentioned has two separate params for refRate i.e RefBidRate and RefAskRate.
    VertexFxBoapi10 has closeposition with only one param i.e RefRate.

    Which rate should i pass?

    Request you to post example for VertexFxBoApi10 as I am not figuring out.

    Thanks in anticipation sir.

  15. #30
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    347

    Default

    Quote Originally Posted by jay.thakkar@gmail.com View Post
    The link you mentioned has two separate params for refRate i.e RefBidRate and RefAskRate.
    VertexFxBoapi10 has closeposition with only one param i.e RefRate.

    Which rate should i pass?

    Request you to post example for VertexFxBoApi10 as I am not figuring out.

    Thanks in anticipation sir.
    You have to pass the ref price according the position type so if the closed position is Buy type you have to pass the RefBid price value else pass the RefAsk price

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unable to connect by C#.NET sample with VertexFX API
    By charusingla in forum VertexFX API/VTL Forum
    Replies: 3
    Last Post: 11-14-2017, 06:10 AM
  2. AccessViolationException at API.Login in VB.NET CLIENT API Sample
    By PavelK in forum VertexFX API/VTL Forum
    Replies: 3
    Last Post: 09-02-2017, 06:26 AM
  3. Unable to connect by VB.NET sample with VertexFX API
    By Alexander Sokhanych in forum VertexFX API/VTL Forum
    Replies: 12
    Last Post: 01-09-2014, 09:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •