Interface IFinancialDataSerializer
- Namespace
- Tudormobile.FinancialData
- Assembly
- Tudormobile.FinancialData.dll
Defines methods for serializing and deserializing financial data objects, such as balance sheets and stock prices.
public interface IFinancialDataSerializer
Remarks
Implementations of this interface should provide the logic for converting financial data to a string format and vice versa. The Serialize methods convert specific financial data types into a JSON string, while the Deserialize method reconstructs an object of type T from a JSON document.
Methods
Deserialize<T>(JsonDocument)
Deserializes the specified JSON document to an object of the specified type.
T Deserialize<T>(JsonDocument doc)
Parameters
docJsonDocumentThe JSON document to deserialize, represented as a JsonDocument instance.
Returns
- T
An object of type T that represents the data contained in the JSON document.
Type Parameters
TThe type of the object to create from the JSON document.
Remarks
The structure of the JSON document must match the properties of the target type T for successful deserialization. If the document does not conform to the expected structure, an exception may be thrown.
Serialize(BalanceSheet)
Serializes the specified BalanceSheet object to its JSON string representation.
string Serialize(BalanceSheet balanceSheet)
Parameters
balanceSheetBalanceSheetThe BalanceSheet object to serialize. This parameter must not be null.
Returns
- string
A JSON string that represents the serialized StockPrice object.
Remarks
Use this method to convert a StockPrice instance into a format suitable for storage or transmission. Ensure that the StockPrice object is fully populated before serialization.
Serialize(StockPrice)
Serializes the specified StockPrice object to its JSON string representation.
string Serialize(StockPrice stockPrice)
Parameters
stockPriceStockPriceThe StockPrice object to serialize. This parameter must not be null.
Returns
- string
A JSON string that represents the serialized StockPrice object.
Remarks
Use this method to convert a StockPrice instance into a format suitable for storage or transmission. Ensure that the StockPrice object is fully populated before serialization.