|
19 | 19 | from .CurrencyAmount import CurrencyAmount |
20 | 20 | from .CurrencyAmount import from_json as CurrencyAmount_from_json |
21 | 21 | from .Entity import Entity |
| 22 | +from .LightningPaymentDirection import LightningPaymentDirection |
22 | 23 | from .LightsparkNodeStatus import LightsparkNodeStatus |
23 | 24 | from .LightsparkNodeToChannelsConnection import LightsparkNodeToChannelsConnection |
24 | 25 | from .LightsparkNodeToChannelsConnection import ( |
25 | 26 | from_json as LightsparkNodeToChannelsConnection_from_json, |
26 | 27 | ) |
| 28 | +from .LightsparkNodeToDailyLiquidityForecastsConnection import ( |
| 29 | + LightsparkNodeToDailyLiquidityForecastsConnection, |
| 30 | +) |
| 31 | +from .LightsparkNodeToDailyLiquidityForecastsConnection import ( |
| 32 | + from_json as LightsparkNodeToDailyLiquidityForecastsConnection_from_json, |
| 33 | +) |
27 | 34 | from .Node import Node |
28 | 35 | from .NodeAddressType import NodeAddressType |
29 | 36 | from .NodeToAddressesConnection import NodeToAddressesConnection |
@@ -248,6 +255,52 @@ def get_channels( |
248 | 255 | connection = json["entity"]["channels"] |
249 | 256 | return LightsparkNodeToChannelsConnection_from_json(self.requester, connection) |
250 | 257 |
|
| 258 | + def get_daily_liquidity_forecasts( |
| 259 | + self, |
| 260 | + from_date: datetime, |
| 261 | + to_date: datetime, |
| 262 | + direction: LightningPaymentDirection, |
| 263 | + ) -> LightsparkNodeToDailyLiquidityForecastsConnection: |
| 264 | + json = self.requester.execute_graphql( |
| 265 | + """ |
| 266 | +query FetchLightsparkNodeToDailyLiquidityForecastsConnection($entity_id: ID!, $from_date: Date!, $to_date: Date!, $direction: LightningPaymentDirection!) { |
| 267 | + entity(id: $entity_id) { |
| 268 | + ... on LightsparkNode { |
| 269 | + daily_liquidity_forecasts(, from_date: $from_date, to_date: $to_date, direction: $direction) { |
| 270 | + __typename |
| 271 | + lightspark_node_to_daily_liquidity_forecasts_connection_from_date: from_date |
| 272 | + lightspark_node_to_daily_liquidity_forecasts_connection_to_date: to_date |
| 273 | + lightspark_node_to_daily_liquidity_forecasts_connection_direction: direction |
| 274 | + lightspark_node_to_daily_liquidity_forecasts_connection_entities: entities { |
| 275 | + __typename |
| 276 | + daily_liquidity_forecast_date: date |
| 277 | + daily_liquidity_forecast_direction: direction |
| 278 | + daily_liquidity_forecast_amount: amount { |
| 279 | + __typename |
| 280 | + currency_amount_original_value: original_value |
| 281 | + currency_amount_original_unit: original_unit |
| 282 | + currency_amount_preferred_currency_unit: preferred_currency_unit |
| 283 | + currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded |
| 284 | + currency_amount_preferred_currency_value_approx: preferred_currency_value_approx |
| 285 | + } |
| 286 | + } |
| 287 | + } |
| 288 | + } |
| 289 | + } |
| 290 | +} |
| 291 | + """, |
| 292 | + { |
| 293 | + "entity_id": self.id, |
| 294 | + "from_date": from_date, |
| 295 | + "to_date": to_date, |
| 296 | + "direction": direction, |
| 297 | + }, |
| 298 | + ) |
| 299 | + connection = json["entity"]["daily_liquidity_forecasts"] |
| 300 | + return LightsparkNodeToDailyLiquidityForecastsConnection_from_json( |
| 301 | + self.requester, connection |
| 302 | + ) |
| 303 | + |
251 | 304 | def to_json(self) -> Mapping[str, Any]: |
252 | 305 | return { |
253 | 306 | "__typename": self.typename, |
|
0 commit comments