Skip to content

Commit

Permalink
Merge pull request #1155 from get10101/chore/change-contract-duration…
Browse files Browse the repository at this point in the history
…-to-7-days

chore: change contract duration to 7 days
  • Loading branch information
holzeis authored Aug 24, 2023
2 parents 923139f + 3fa9eb4 commit bafcff3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add synthetic usd feature.
- Fix delayed position update.
- Change contract duration to 7 days.

## [1.2.2] - 2023-08-22

Expand Down
2 changes: 1 addition & 1 deletion coordinator/src/orderbook/trading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn match_order(
return Ok(None);
}

let tomorrow = OffsetDateTime::now_utc().date() + Duration::days(2);
let tomorrow = OffsetDateTime::now_utc().date() + Duration::days(7);
let expiry_timestamp = tomorrow.midnight().assume_utc();

// For now we hardcode the oracle pubkey here
Expand Down
8 changes: 4 additions & 4 deletions coordinator/src/rollover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Rollover {
///
/// todo(holzeis): this should come from a configuration https://github.com/get10101/10101/issues/1029
pub fn maturity_time(&self) -> OffsetDateTime {
let tomorrow = self.expiry_timestamp.date() + Duration::days(2);
let tomorrow = self.expiry_timestamp.date() + Duration::days(7);
tomorrow.midnight().assume_utc()
}
}
Expand Down Expand Up @@ -204,9 +204,9 @@ pub mod tests {
};
let event_id = rollover.event_id();

// expect expiry in two days at midnight.
// Sat Aug 19 2023 00:00:00 GMT+0000
assert_eq!(event_id, format!("btcusd1692403200"))
// expect expiry in seven days at midnight.
// Thu Aug 24 2023 00:00:00 GMT+0000
assert_eq!(event_id, format!("btcusd1692835200"))
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/tests-e2e/tests/rollover_position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn can_rollover_position() {
.unwrap();

let position = test.app.rx.position().expect("position to exist");
let tomorrow = position.expiry.date() + Duration::days(2);
let tomorrow = position.expiry.date() + Duration::days(7);
let new_expiry = tomorrow.midnight().assume_utc();

coordinator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class TradeBottomSheetConfirmation extends StatelessWidget {
if (!close)
ValueDataRow(
type: ValueType.date,
value: DateTime.utc(now.year, now.month, now.day + 2).toLocal(),
value: DateTime.utc(now.year, now.month, now.day + 7).toLocal(),
label: 'Expiry'),
close
? ValueDataRow(
Expand Down
2 changes: 1 addition & 1 deletion mobile/native/src/trade/position/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub fn update_position_after_dlc_creation(filled_order: Order, collateral: u64)

let average_entry_price = filled_order.execution_price().unwrap_or(0.0);

let tomorrow = OffsetDateTime::now_utc().date() + Duration::days(2);
let tomorrow = OffsetDateTime::now_utc().date() + Duration::days(7);
let expiry = tomorrow.midnight().assume_utc();

let have_a_position = Position {
Expand Down

0 comments on commit bafcff3

Please sign in to comment.