Dim serialized = Newtonsoft.Json.JsonConvert.SerializeObject(gridOrderNewState)
Dim gridOrderNewstate2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Of gridTradingState)(serialized)
The result is almost empty version of gridOrderNewstate2
This is the value of serialized
{
"bidInBase":0.99055,
"askInBase":0.99333,
"high":0.99448,
"low":0.97528,
"dateSinceLastTransactions":"2022-11-14T21:04:34.0103292+07:00",
"suggestedLow":0.0,
"suggestedhigh":0.0,
"Orders":[
{
"time":"2022-11-14T13:09:54",
"id":"227286807874",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.25,
"priceInBasecoin":1.0,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":true,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807867",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.263,
"priceInBasecoin":0.99778,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":true,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807859",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.277,
"priceInBasecoin":0.99556,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":true,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807851",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.291,
"priceInBasecoin":0.99333,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":true,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807835",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.334,
"priceInBasecoin":0.98667,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":false,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807823",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.348,
"priceInBasecoin":0.98444,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":false,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807816",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.363,
"priceInBasecoin":0.98222,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":false,
"marketURL":"https://gate.io/trade/frax_usdt"
},
{
"time":"2022-11-14T13:09:54",
"id":"227286807762",
"customIdentifier":"t-FraxTest",
"amountOfQuoteCurrencyBeingOrdered":6.377,
"priceInBasecoin":0.98,
"marketString":"gate",
"Base":"USDT",
"Quote":"FRAX",
"isSellingInsteadOfBuying":false,
"marketURL":"https://gate.io/trade/frax_usdt"
}
]
}
So obviously something is there.
Yet I cannot deserialize into the same object class.
This is the class by the way
Class gridTradingState
ReadOnly Property bidInBase As Decimal
ReadOnly Property askInBase As Decimal
ReadOnly Property high As Decimal
ReadOnly Property low As Decimal
ReadOnly Property dateSinceLastTransactions As Date
ReadOnly Property suggestedLow As Decimal
ReadOnly Property suggestedhigh As Decimal
ReadOnly Property Orders As OrderAlreadyPlacedAtanExchange()
Public Shared Function creategridTradingOldState(market As MarketPairInanExchange, ordersInp As OrderAlreadyPlacedAtanExchange()) As gridTradingState
Dim currentState = New gridTradingState
'currentState._bidInBase = market.askbidInBase(False)
'currentState._askInBase = market.askbidInBase(True)
currentState._bidInBase = market.bidInBaseCoin
currentState._askInBase = market.askInBaseCoin
currentState._high = market.highInBaseCoin
currentState._low = market.lowInBaseCoin
currentState._Orders = ordersInp
currentState._dateSinceLastTransactions = Now
Return currentState
End Function
Public Sub updateSuggestedLowandHigh(suggestedLowNew As Decimal, suggestedHighNew As Decimal)
_suggestedLow = suggestedLowNew
_suggestedhigh = suggestedHighNew
End Sub
End Class
Someone asked for a minimally reproduceable sample. I remove orders. The content of serialize becomes
{
"bidInBase": 0.98735,
"askInBase": 0.9918,
"high": 0.99448,
"low": 0.97528,
"dateSinceLastTransactions": "2022-11-14T22:47:47.5532599+07:00",
"suggestedLow": 0.0,
"suggestedhigh": 0.0
}
And the problem stays. It seems that dbc is onto something