API Support Forum
User Profile

Viewing User Profile for: FGiordano538


About

May 09, 2022 01:28 PM

Jan 29, 2024 03:04 AM

Jan 29, 2024 03:05 AM



Post Statistics
FGiordano538 has contributed to 24 posts out of 5593 total posts (0.43%) in 716 days (0.00 posts per day).

20 most recent posts:

API Support » System.TypeLoadException Jan 29, 2024 @ 03:04 AM (Total replies: 5)

Good morning, I restarted the old project without updates and only updated the GFAPI.4.11.519.358 package.
Now everything works.
Thank you.

API Support » System.TypeLoadException Jan 25, 2024 @ 09:00 AM (Total replies: 5)

I used the latest version of the AdvancedExample and updated the GFAPI references to the latest version.
I'm having this problem with both the C# example and my VB.net executable that worked before the update.

API Support » System.TypeLoadException Jan 24, 2024 @ 07:22 AM (Total replies: 5)

I have updated the package "GFAPI 4.11.519.358" and now I am getting this error on this command "GF.Api.Impl.GFApi.CreateClient()":

"System.TypeLoadException: 'Il metodo 'TryGetConstructor' del tipo 'GF.SimpleInjector.InternalConstructorResolutionBehavior' dell'assembly 'GF.SimpleInjector, Version=4.11.519.358, Culture=neutral, PublicKeyToken=b6b45f27e2749b17' non ha un'implementazione.'".

I also have the same error with the advanced example.
What am I doing wrong?
Thank you."

Order Execution » Order compound Sep 15, 2022 @ 10:38 AM (Total replies: 2)

They have done API update
https://apisupport.gainfutures.com/Topic/Index/1459

Order Execution » CompoundType "Custom" cod. 88 Sep 15, 2022 @ 09:40 AM (Total replies: 10)

TK.
With the API of a Block Account, is it possible to have the total position? I have the position of the individual accounts, but the total one, as if it were a single account, gives me back 0. I solved it by cycling the sub-accounts, but if it were possible to have it directly it would be better.

Thanks and sorry if I take advantage.
I write you the code that I use now

Dim GL_Account_AB As IAccount = gfClient.Accounts.Wash.Get.First
Dim GL_Account_ As IAccount = gfClient.Accounts.Get().First

Dim account As Accounts.IAccount = Nothing
Dim totalBalance As Balances.IBalance = Nothing
If GL_Account_AB Is GL_Account_ Then
Dim Disp_ As Double = 0
Dim Liq_ As Double = 0
For Each Account_ In gfClient.Accounts.Get
totalBalance = Account_.TotalBalance
Disp_ += totalBalance.NetLiq - totalBalance.PortfolioMargin.RiskValue
Liq_ += totalBalance.PortfolioMargin.MaintenanceReq
Next

Lbl_Disponibilita.Text = FormatNumber(Disp_, 0)
Lbl_LiquiditaVinc.Text = FormatNumber(Liq_, 0)

Else
totalBalance = GL_Account_.TotalBalance
Lbl_Disponibilita.Text = FormatNumber(totalBalance.NetLiq - totalBalance.PortfolioMargin.RiskValue, 0)
Lbl_LiquiditaVinc.Text = FormatNumber(totalBalance.PortfolioMargin.MaintenanceReq, 0)

End If
Edited by FGiordano538 on Sep 15, 2022 09:46 AM
Edited by FGiordano538 on Sep 15, 2022 12:21 PM
Edited by FGiordano538 on Sep 27, 2022 03:41 AM

Order Execution » CompoundType "Custom" cod. 88 Sep 14, 2022 @ 02:14 AM (Total replies: 10)

Thanks now it works

Order Execution » CompoundType "Custom" cod. 88 Sep 13, 2022 @ 04:13 AM (Total replies: 10)

I have installed the new version, but it returns this error. In the link I have also inserted the image of the installed packages. https://imgur.com/a/YVS4Hjn
Then I updated the versions of all the packages, and it gives me a different error. I'll post the error and packages with versions.https://imgur.com/a/ihAklZW
What am I doing wrong?
Thank you.

Order Execution » CompoundType "Custom" cod. 88 Sep 12, 2022 @ 04:33 AM (Total replies: 10)

GFAPI.4.0.3.44.nupkg

Order Execution » Order compound Sep 09, 2022 @ 04:03 AM (Total replies: 2)

Hello, I need to place a complex, synthetic order with three titles (legs), on the platform I use the "Custom" type Code 88, but among the various types of orders with the API the codes range from 0 to 87. It is Is it possible to create a complex order of the Custom Code 88 type through the API?

Order Execution » CompoundType "Custom" cod. 88 Sep 08, 2022 @ 04:21 AM (Total replies: 10)

Thanks for the reply J.Smith.
If I want to place an order with 3 legs (BUY 1 OESM23 P3000, SELL 1 OESM23 P2800, SELL 1 OESH23 P2700) what can I do?
What type of "CompoundType" should I use?
Edited by FGiordano538 on Sep 08, 2022 04:23 AM

Order Execution » CompoundType "Custom" cod. 88 Aug 23, 2022 @ 07:18 AM (Total replies: 10)

Visual Basic
Dim CustComp_ As GF.Api.Contracts.CustomCompounds.CustomCompoundTemplate
Dim List_CustomCompoundLegs = New List(Of CustomCompoundLegTemplate)
Dim Leg_1, Leg_2 As GF.Api.Contracts.CustomCompounds.CustomCompoundLegTemplate
Dim order As IOrder = Nothing
Dim OrderDraft = New OrderDraftBuilder()
Try
If TitoloAperto1 Is Nothing Or TitoloAperto2 Is Nothing Then Exit Sub
Leg_1 = New CustomCompoundLegTemplate(TitoloAperto1.ID, OrderSide.Buy, 1)
List_CustomCompoundLegs.Add(Leg_1)
Leg_2 = New CustomCompoundLegTemplate(TitoloAperto2.ID, OrderSide.Sell, 1)
List_CustomCompoundLegs.Add(Leg_2)
CustComp_ = New CustomCompoundTemplate(CompoundType.RatioSpread, List_CustomCompoundLegs)
OrderDraft.WithAccountID(AccountInvioAmeracato.ID)
OrderDraft.WithCustomCompound(CustComp_)
OrderDraft.WithSide(OrderSide.Buy)
OrderDraft.WithOrderType(OrderType.Limit)
OrderDraft.WithPrice(1)
OrderDraft.WithQuantity(1)
OrderDraft.WithEnd(DateTime.UtcNow.AddMinutes(1400))
OrderDraft.WithComments(CustComp_.CompoundType.ToString)
OrderDraft.WithFlags(0)
OrderDraft.Build()
Dim validationErrors As New List(Of OrderDraftValidationError)
validationErrors = Form1.gfClient.Orders.Drafts.Validate(OrderDraft.Build)
Dim FraseErrore As String = ""
If (validationErrors.Any()) Then
For id_ = 0 To validationErrors.Count - 1
FraseErrore = ($"\t{validationErrors(id_).Message}" & vbCrLf)

Next
Debug.Print(FraseErrore)

Else

Debug.Print(AccountInvioAmeracato.ID.ToString & " -- " & AccountInvioAmeracato.Spec & " -- " & OrderDraft.Build.Quantity & " / " &
OrderDraft.Build.Price & " - " & OrderDraft.Build.Side.ToString & " - " & OrderDraft.Build.Comments)

Form1.gfClient.Orders.SendOrder(OrderDraft.Build)
End If

Catch ex As Exception
MsgBox("Errore : " & ex.Message)

End Try
-----------------------------------------------------------------------------------------------------------------------
this is a compound order, (BUY 1 OESM23 P3000, SELL 1 OESM23 P2800)
if I send it as "PutHorizontal" or as "RatioSpread", in the end it always takes it as "RatioSpread" and goes to market exactly.
as seen from the attached order status pictures
https://imgur.com/a/1jQBqMa
I tried to do the following order in the same way (BUY 1 OESM23 P3000, SELL 1 OESH23 P3000)
i sent it as "PutHorizontal", which should be exact, but rejects it, as seen from the attached order status pictures,
and does not take it with any CompoundType. From the "GAIN Trader" only accepts it with
CompoundType "Custom" cod. 88 which does not exist in the API. Qulacuno can tell me if it is solvable?
Thank you.

Order Execution » order CustomCompound Aug 11, 2022 @ 04:59 AM (Total replies: 1)

Errore mio
Edited by FGiordano538 on Aug 11, 2022 07:01 AM

Order Execution » order CustomCompound Aug 10, 2022 @ 03:06 AM (Total replies: 1)

errore
Edited by FGiordano538 on Sep 19, 2022 02:30 AM
Edited by FGiordano538 on Sep 19, 2022 02:30 AM

Market Data » ID function Jul 15, 2022 @ 02:53 AM (Total replies: 2)

thank you

Advanced Order Management » Option spreads Jul 13, 2022 @ 12:12 PM (Total replies: 3)

AzzeraPreOrdineOrdine()
Dim CustComp_ As GF.Api.Contracts.CustomCompounds.CustomCompoundTemplate
Dim List_CustomCompoundLegs = New List(Of CustomCompoundLegTemplate)
Dim Leg_1, Leg_2, Leg_3, Leg_4 As GF.Api.Contracts.CustomCompounds.CustomCompoundLegTemplate
Dim Segno_Figura As OrderSide
Dim Segno_Titolo_1 As OrderSide
Dim Segno_Titolo_2 As OrderSide
Dim Segno_Titolo_3 As OrderSide
Dim Segno_Titolo_4 As OrderSide
Dim order As IOrder = Nothing

Try


If Side_ = "BUY" Then
Segno_Figura = OrderSide.Buy

ElseIf Side_ = "SELL" Then
Segno_Figura = OrderSide.Sell

End If
If Cmb_Segno1.SelectedItem.ToString.ToUpper = "BUY" Then
Segno_Titolo_1 = OrderSide.Buy

ElseIf Cmb_Segno1.SelectedItem.ToString.ToUpper = "SELL" Then
Segno_Titolo_1 = OrderSide.Sell

End If

If Cmb_Segno2.SelectedItem.ToString.ToUpper = "BUY" Then
Segno_Titolo_2 = OrderSide.Buy

ElseIf Cmb_Segno2.SelectedItem.ToString.ToUpper = "SELL" Then
Segno_Titolo_2 = OrderSide.Sell

End If

If Cmb_Segno3.SelectedItem.ToString.ToUpper = "BUY" Then
Segno_Titolo_3 = OrderSide.Buy

ElseIf Cmb_Segno3.SelectedItem.ToString.ToUpper = "SELL" Then
Segno_Titolo_3 = OrderSide.Sell

End If

If Cmb_Segno4.SelectedItem.ToString.ToUpper = "BUY" Then
Segno_Titolo_4 = OrderSide.Buy

ElseIf Cmb_Segno4.SelectedItem.ToString.ToUpper = "SELL" Then
Segno_Titolo_4 = OrderSide.Sell

End If


If Not TitoloAperto1 Is Nothing Then
Leg_1 = New CustomCompoundLegTemplate(TitoloAperto1.ID, Segno_Titolo_1, CInt(Tbx_Qta_1.Text))
List_CustomCompoundLegs.Add(Leg_1)

If Not TitoloAperto2 Is Nothing Then
Leg_2 = New CustomCompoundLegTemplate(TitoloAperto2.ID, Segno_Titolo_2, CInt(Tbx_Qta_2.Text))
List_CustomCompoundLegs.Add(Leg_2)

If Not TitoloAperto3 Is Nothing Then
Leg_3 = New CustomCompoundLegTemplate(TitoloAperto3.ID, Segno_Titolo_3, CInt(Tbx_Qta_3.Text))
List_CustomCompoundLegs.Add(Leg_3)

If Not TitoloAperto4 Is Nothing Then
Leg_4 = New CustomCompoundLegTemplate(TitoloAperto4.ID, Segno_Titolo_4, CInt(Tbx_Qta_4.Text))
List_CustomCompoundLegs.Add(Leg_4)

End If

End If

End If

End If

CustComp_ = New CustomCompoundTemplate(CompoundType.Synthetic, List_CustomCompoundLegs)
Dim OrderDraft = New OrderDraftBuilder()
OrderDraft.WithAccountID(Form1.AccountID_)
OrderDraft.WithCustomCompound(CustComp_)
OrderDraft.WithSide(Segno_Figura)
If Cmb_TipoPrz.SelectedItem.ToString.ToUpper = "LIMIT" Then
OrderDraft.WithOrderType(OrderType.Limit)

Else
OrderDraft.WithOrderType(OrderType.Market)

End If
OrderDraft.WithPrice(CDbl(Tbx_PrzSintetico.Text))
OrderDraft.WithQuantity(CInt(Tbx_QtaFigure.Text))
OrderDraft.WithEnd(DateTime.UtcNow.AddMinutes(1400))
OrderDraft.WithComments("Synthetic")
OrderDraft.WithFlags(0)
OrderDraft.Build()
OrdineDaInviare_COMPL = OrderDraft

Dim validationErrors As New List(Of OrderDraftValidationError)
validationErrors = Form1.gfClient.Orders.Drafts.Validate(OrderDraft.Build)
Dim FraseErrore As String = ""
Pnl_PreparaOrdine.Visible = False
Pnl_ConfermaOrdine.Visible = True
If (validationErrors.Any()) Then
For id_ = 0 To validationErrors.Count - 1
FraseErrore = ($"\t{validationErrors(id_).Message}" & vbCrLf)

Next

Tbx_Messaggio.Text = FraseErrore
Cmd_Esegui.Enabled = False

Else
Dim RiepilogoOrdine As String = ""
Lbl_Account.Text = GL_Account_Conto


Lbl_PrezzoNetto.Text = FormatNumber(OrderDraft.Build.Price, 2)
Lbl_NumeroFig.Text = OrderDraft.Build.Quantity

Dim ORDER_ As IOrder
ORDER_ = Form1.gfClient.Orders.SendOrder(OrdineDaInviare_COMPL.Build)


End If
ControlloOrdineDaConfermare_C(Segno_Figura.ToString, OrderDraft.Build.Price)
Catch ex As Exception
MsgBox("Errore : " & ex.Message)

End Try
----------------------------------------------------------

This works, but is there a way to review the entire order before sending it to market?
Thank you
Edited by FGiordano538 on Jul 13, 2022 12:15 PM

Market Data » ID function Jun 23, 2022 @ 04:59 AM (Total replies: 2)

there is a function that returns the contracts.id through the symbol.
without going through the SymbolLookupEventArgs event?

Market Data » multiple subscription Jun 17, 2022 @ 05:50 AM (Total replies: 6)

I solved, with "Client.Contracts.Lookup.BySymbol (Symbol)",
scrolling through a list and I request the data of the title individually and then I subscribe it.
Same thing to unsubscribe.
So I don't have the 50 limit of the "client.Contracts.Lookup.ByCriteria" command

Market Data » download a list of CME market options Jun 17, 2022 @ 05:17 AM (Total replies: 3)

with the command "client.Contracts.Lookup.ByCriteria", I can download symbols with a common base, maximum 50.
With "Client.Contracts.Lookup.BySymbol (Tit_)" I download as many as I want, but I need to know the exact symbol.
it seems to me that with the command "Client.Contracts.Load.Request (Request.Build)", I can download all the options of an underlying in groups of 1000. I tried but failed.
Place the code.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TitoliRichiesti = gfClient.Contracts.Lookup.BySymbol("ESZ22")

End Sub

Sub gfClient_SymbolLookupReceived_(c As IGFClient, e As SymbolLookupEventArgs)
If e.RequestID = TitoliRichiesti Then
For Each contract As GF.Api.Contracts.IContract In e.Contracts
ScaricaOp_Sottostante(contract)
Next

End If

End Sub
Private Sub ScaricaOp_Sottostante(contract As GF.Api.Contracts.IContract)

If contract.HasOptions Then
Dim _loadContractExpression As New ContractLoadExpressionBuilder

_loadContractExpression.Push(New ParentContractIDCriterion(contract.ID))
_loadContractExpression.Build()

Dim Request As New ContractLoadRequestBuilder()
Request.WithSkipCount(0)
Request.WithResultCount(1000)

Request.WithExpression(_loadContractExpression.Build)
Request.Build()

_loadRequestID = gfClient.Contracts.Load.Request(Request.Build)
End If
End Sub

it returns me this error
"System.InvalidOperationException: 'Tree must have single root. Push more operators."

Advanced Order Management » Option spreads Jun 16, 2022 @ 11:48 AM (Total replies: 3)

is there an example in visual basic.net o C#?
Edited by FGiordano538 on Jul 11, 2022 03:00 AM

Market Data » download a list of CME market options Jun 16, 2022 @ 08:48 AM (Total replies: 3)

Hello, I need to download a list of CME market options, including all of them. Is there a command? And if so, is there an example in vb.net?
Thank you